Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Annotation in Dynamic Web Project (cannot change version of project facet dynamic web module 2.5)
Annotation in Dynamic Web Project (cannot change version of project facet dynamic web module 2.5) [message #852147] Sat, 21 April 2012 14:27 Go to next message
roy lou is currently offline roy lou
Messages: 10
Registered: April 2012
Junior Member
Environment:
Eclipse SR2 + Tomcat 7.0.26 + SE JDK 1.7
Description:
I created a servlet under a Dynamic Web Project in Eclipse and specified initialized parameter(s) in [Create Servlet] pane. After the new servlet is created, I couldn't locate <init-param> section in web.xml. Instead, the initialized parameters were found to be declared in the code as the form of annotation: @WebServlet(initParams = { @WebInitParam(name = "USD_CAD", value = "1.06")}) above servlet class definition.
Question:
1. Is there a way to create servlets within Dynamic Web Project without Eclipse using annotation approach? So that they will be showing in web.xml's <init-parm> sections? Thanks!
2. Does it take to configure somewhere in the Eclipse? Thanks!

From google result, i found out that i need to change my project facet from currently 3.0 to 2.5 to fix this issue. Howebver "cannot change version of project facet dynamic web module 2.5" is what i got whey i tried. Need someone to shed the light on this. Thanks!

[Updated on: Sun, 22 April 2012 00:14]

Report message to a moderator

Re: Annotation in Dynamic Web Project [message #852479 is a reply to message #852147] Sat, 21 April 2012 23:13 Go to previous messageGo to next message
roy lou is currently offline roy lou
Messages: 10
Registered: April 2012
Junior Member
This can be fixed during project creation by checking [Generate web.xml deployment descriptor] checkbox in the [Web Module] pane. Then each initialized parameter added during new servlet creation will be available in web.xml.
Re: Annotation in Dynamic Web Project [message #852492 is a reply to message #852479] Sat, 21 April 2012 23:30 Go to previous message
roy lou is currently offline roy lou
Messages: 10
Registered: April 2012
Junior Member
No, checking that checkbox will not resolve the issue.
Previous Topic:Dynamic Web project don't copy any file to wtpwebapps directory
Next Topic:Editing Library in build path
Goto Forum:
  


Current Time: Sun May 19 04:50:44 EDT 2013

Powered by FUDForum. Page generated in 0.07919 seconds