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 messageGo to next message
roy lou is currently offline roy lou
Messages: 10
Registered: April 2012
Junior Member
No, checking that checkbox will not resolve the issue.
Re: Annotation in Dynamic Web Project (cannot change version of project facet dynamic web module 2.5 [message #1173226 is a reply to message #852147] Wed, 06 November 2013 06:25 Go to previous messageGo to next message
Paulo Kopzinski is currently offline Paulo Kopzinski
Messages: 1
Registered: November 2013
Junior Member
Sorry, I really need "wake up" this topic...

I have the same problem, I'm using maven-war-plugin, I need tomcat6, javaee5, e dynamic web 2.5

BUT I can't... Anybody found a solution?
Re: Annotation in Dynamic Web Project (cannot change version of project facet dynamic web module 2.5 [message #1174055 is a reply to message #1173226] Wed, 06 November 2013 18:05 Go to previous message
Denis Golovin is currently offline Denis Golovin
Messages: 18
Registered: July 2009
Junior Member
What I did is removed Dynamic Web Facet 3.0 by deselecting it in Projects Facets preferences for the project. Hit Apply and then enabled it again with required version. Worked for me. Don't forget to back up your project before trying this workaroung.
Previous Topic:Trouble with preferences when using XMLMultiPageEditorPart
Next Topic:Webservice client project option missing
Goto Forum:
  


Current Time: Sat Aug 30 20:30:28 EDT 2014

Powered by FUDForum. Page generated in 0.01963 seconds