如何为 Java Servlet 和 JSP 配置 Eclipse
我正在做jsp。我有 eclipse 但不知道如何为 servlet 和 jsp 配置它。我想开发和调试我的网络应用程序。我应该从哪里获取哪个插件?
I am working on jsp. I have eclipse but don't know how to configure it for servlets and jsps. I want to develop and debug my web application. Which plugin should I get and from where?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该下载正确的版本,而不是安装插件。
下载:面向 Java EE 开发人员的 Eclipse IDE,212 MB
此版本从 WTP/Web 工具平台插件。
我不确定是否包含像 Tomcat 这样的应用程序服务器。否则下载它。
然后将tomcat添加到eclipse。 (还有其他指南,只需谷歌一下即可。)
Instead of installing plugins you should download the right version.
Download: Eclipse IDE for Java EE Developers, 212 MB
This one has the Web Development perspective from the WTP/Web Tools Platform plugin.
I'm not sure if an application server like Tomcat is included. Otherwise download it.
Afterwards add tomcat to eclipse. (There are other guides as well, just google them.)
你必须安装像 apache 或 glasfish 或 jboss 这样的服务器才能在其上运行 jsp 和 servlet 我建议你下载 oepe eclipse 版本的 oracle
它有一些额外的 eclipse 插件,例如预览 jsp和 html 页面并显示用于 jsf 开发的调色板,并支持 ADF。
you have to install a server like apache or glasfish or jboss to be able to run jsp and servlets on it I suggest you to download the oepe eclipse version of oracle
it has some additional addons to eclipse like previewing jsp and html pages and displaying palette for jsf development and suports ADF its greate.
请遵循此分步指南:
下载 Eclipse 和Java
安装与安装设置
安装位置(C:\Program Files\Java)。
以下是如何在Windows 10中设置环境变量。(我假设Win 7/8也是如此)
注意:如果您在其他地方安装了 JDK 和 Tomcat,则必须在下面的变量值中输入更新位置的完整路径。
对于 JDK
对于 JRE,添加另一个变量
对于 Tomcat,添加另一个 catalina 变量
设置 Eclipse 进行动态 Web 开发
从您提取并保存的目录中打开 eclipse.exe
导航到帮助>安装新软件..
在使用:中输入“http://download.eclipse.org/releases/luna”并按 Enter< /p>
在“Web、XML、Java EE 和 OSGi”下Enterprise Development”,选择以下选项并安装
Eclipse Java EE 开发人员工具
Eclipse Java Web 开发人员工具
Eclipse Web 开发人员工具
JST 服务器适配器
JST 服务器适配器扩展
JST服务器U
重新启动 Eclipse安装后出现提示时
现在,您可以在 Eclipse 中创建动态 Web 应用程序!
转到文件>新的>其他>在网络>下动态Web应用程序
输入项目名称并单击“下一步”
您可以将内容目录名称 (WebContent) 更改为您喜欢的任何名称;但在这里,我暂时将其保留为 WebContent。
点击完成
在项目资源管理器中,右键单击WebContent >新的> JSP 文件 并向其中添加您喜欢的任何内容,然后保存项目。将 JSP 文件命名为“example.jsp”
打开 eclipse 工作区位置(通常位于C:\Users%YourName%\Documents\Java\WORKSPACE)< /p>
复制WebContent文件夹并将其粘贴到 C: > Tomcat8.0>>网络应用
在 Apache Tomcat 上运行项目
http://localhost:8080/
,您应该会看到 Tomcat 的菜单。Follow this step-by-step guide:
Downloading Eclipse & Java
Installation & Set up
installation location (C:\Program Files\Java).
Here's how you can setup environment variables in Windows 10. (I assume same goes for Win 7/8)
NOTE: If you installed JDK and Tomcat somewhere else, then you will have to enter the full path of the updated location below in the Variable Values.
For JDK
For JRE, add another variable
For Tomcat, add another catalina variable
Set up Eclipse for Dynamic Web Development
Open eclipse.exe from the directory you Extracted and Saved it
Navigate to Help > Install New Software..
Enter "http://download.eclipse.org/releases/luna" in Work with: and hit enter
Under "Web, XML, Java EE and OSGi Enterprise Development", select the following options and install them
Eclipse Java EE Developer Tools
Eclipse Java Web Developer Tools
Eclipse Web Developer Tools
JST Server Adapters
JST Server Adapters Extensions
JST Server U
Restart Eclipse when prompted after installation
Now, you can create a Dynamic Web Application in Eclipse!
Go to File > New > Other > under Web > Dynamic Web Application
Enter a project name and click Next
You can change the Content Directory name (WebContent) to whatever name you prefer; but here, I am keeping it as WebContent for now.
Click on Finish
In the Project Explorer, right click on WebContent > New > JSP File and add any content you like to it, and save the Project. Name JSP file to "example.jsp"
Open the eclipse workspace location (usually located at C:\Users%YourName%\Documents\Java\WORKSPACE)
Copy the WebContent folder and paste it into C: > Tomcat8.0 > webapps
Running the Project on Apache Tomcat
http://localhost:8080/
on your browser and you should see the menu of Tomcat.