Wednesday, November 20, 2013

Eclipse WTP neither auto completing nor compiling jsps

<An issue that was resolved>

Hello All,

While using Eclipse juno, I imported an existing project to the workspace, started editing it, but unfortunately the auto complete wasn't working with  jsp files.Further worse, I tried building the project, It didn't do any thing, not giving a compiler error nor warning nor success nor any thing. just the console remained empty.


It seemed unable to understand anything

I tried the following :
1- make sure that jre7 library was included in the libraries of the project. <right click on the project folder - properties - java build path>  ... Didn't work
2-downloaded a new version of eclipse wtp and open the project with. ....Didn't work - gave the same behavior.
3- Created a new web project and started comparing the old with it
4- First I realized that the old one doesn't have 'src' folder -as it was composed of only jsps- so I created it
 ..... since then the auto completing started working !!!! -don't ask  me why, good anyways-  BUT for J2EE classes (request for example) I didn't work (I tried typing request.addMe() ... I didn't complain !! ... No need to mention that the compilation issue persisted)
5- Comparing the libraries of both projects, I found a missing library in the old jar which is 'Apache Tomcat server 7' .... I explored this jar and found that it contained the servlet-api.jar -that's IT- ..... I added the library through : project properties>java build path> libraries >add Library > server runtime > apache tomcat server 7.

Now Working fine ... Full Auto completion, compiles , Compilation errors appearing ... WOW


Update 26/11/2015 :

Don't include servlet-api.jar in the project lib, but instead include a Server(tomcat for example) in your Servers view in eclipse .... and then in the project's properties, choose runtime environment, choose the server you added and then  the project will compile since it refers to the server's servlet-api.jar.

Hope It helps.