search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
30 views
asked Guru 27.1k points 31 50 97

1 Answer

0 votes
Ensure that you're using at least Eclipse IDE for Java EE developers (with the EE). It contains development tools to create dynamic web projects and easily integrate servletcontainers (which is part of Web Tools Platform, WTP). You also need to ensure that you already have a servletcontainer installed which implements at least the same Servlet API as the servletcontainer in the production environment, for example Apache Tomcat, Oracle Glassfish, JBoss AS, etc.
 
A servletcontainer is a concrete implementation of the Servlet API. Note that the Java EE SDK download at Oracle.com basically contains Glassfish. So if you happen to already have downloaded Java EE SDK, then you already have Glassfish. Also note that for example Glassfish and JBoss AS are more than just a servletcontainer, they also supports JSF, EJB, JPA and all other Java EE fanciness.
 
Once having installed both, do the following steps in Eclipse:
 
Integrate servletcontainer in Eclipse. Open the Servers view in the bottom box, rightclick there and choose New > Server. Pick the appropriate servletcontainer make and version and walk through the wizard.
 
Create new dynamic web project in Eclipse which is associated with the integrated servletcontainer. Open the Project Navigator on the left hand side. Rightclick there and choose New > Project and then in menu Web > Dynamic Web Project and set the Target Runtime to the integrated server. Eclipse will then automatically take the servletcontainer's libraries in the build path. This way you'll be able to import and use the Servlet API.
You should above all never manually copy/download/move/include the individual servletcontainer-specific libraries like servlet-api.jar, jsp-api.jar, el-api.jar, j2ee.jar, javaee.jar, etc. It would only lead to future portability, compatibility, classpath and maintainability troubles, because your webapp would not work when it's deployed to a servletcontainer of a different make/version than where those libraries are originally obtained from.
 
Here are some typical exceptions which you can get when you litter the /WEB-INF/lib or even /JRE/lib, /JRE/lib/ext, etc with servletcontainer-specific libraries
 
answered Guru 24.6k points 29 52 81

Related questions

0 votes
1 answer 127 views
0 votes
1 answer 14 views
14 views
asked sara Guru 24.6k points 29 52 81
0 votes
1 answer 255 views
0 votes
1 answer 58 views
58 views
asked sara Guru 24.6k points 29 52 81
0 votes
2 answers 25 views
25 views
asked john Guru 27.1k points 31 50 97
...