When I double click on servlet, web.xml opens in Eclipse?
I am trying to modify some old JSP project in Eclipse. I am running at some (seems trivial) problems.
In Eclipse Project Explorer, there is "Deployment Descriptor: MyApp" element. Inside, there are other sub-elements: Servlets, Servlet Mappings, etc..
My problem is, whatever I try to open (double click) in Servlets or Servlet Mappings, always web.xml gets open. I am trying to open some of servlets to see what they are doing, but this web.xml file keeps popping up.
This web.xml is in WEB-INF folder.
Why is this file opening by default and what is its purpo开发者_Python百科se?
I have created test dynamic web project to try to recreate this issue. This behavior is not happening in test project.
Any ideas,
Thanks.
It depends on the eclipse version. If you want to open the servlet itself you must navigate to the corresponding package and click the classname. I do use eclipse 3.7, in the screenshot shown below it behaves as follows:
- clicking on 'Deployment Desc... > Servlets > Test' opens the Servlet class in Java editor
- clicking on 'Java Resources > src > com.test > Test.java' opens the Servlet class as well
- clicking on 'Deployment Desc... > Servlets' only opens the web.xml
If you migrated an older ''Dynamic Web Project' into your workspace it may behave differently, I've seen strange behaviours in eclipse when it comes to integration of legacy projects. Not a final answer but maybe it helps...
精彩评论