Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Deployment Descriptor & web.xml (Servlet programming)(Deployment Descriptor is removed when web.xml i edited)
Deployment Descriptor & web.xml (Servlet programming) [message #1006100] Tue, 29 January 2013 21:56 Go to next message
Roman Yusupov is currently offline Roman YusupovFriend
Messages: 4
Registered: March 2012
Junior Member
Hello, I am new to Servlets and JSP. I have installed latest Eclipse (Juno) for Java EE development.
I was going to make a simple Hello World dynamic web project using servlets.

Anyway, I've created the HelloWorld servlet using the wizard and it has automatically placed it in the right folder and everything was neat. Then I wanted to do servlet mapping and noticed that there was a node called "servlet-mappings" under the Deployment Descriptor in the project tree. I double clicked a message in the editor that /WebContent/WEB-INF/web.xml did not exist. From there I have tried different solutions. If I create web.xml manually the Deployment Descriptor gets removed. So to generate web.xml I had to right-click on the Deployment Descriptor and choose "Generate Deployment Descriptor Stub" which generated some welcome-pages and a web.xml at the required location. (it took however Eclipse several minutes to figure out that web.xml has been created and not show the source not found message in the editor when I tried to look at the web.xml). Anyway, if I edit the web.xml manually once again the Deployment Descriptor gets removed, also there seems to be some strange bug that once I've manually created or edited the web.xml file Eclipse has trouble creating servlets with "new servlet" wizard. The problem is that even after I fill in the package and the class name the "next" and "finish" buttons remain unclickable. There is also a checkbox that lets you choose an already existing servlet when I check it all of the fields become disabled and when I uncheck the box all the fields remain disabled (so I basically can't do anything except closing the wizard).

I know now that the servlet-mapping is done in @WebServlet(...) in the Servlet itself, but it seems reasonable that I should be able to manually edit web.xml without Eclipse going haywire like that and remove Deployment Descriptor (or perhaps it is supposed to be removed like that?) and prevent me from creating more servlets in such an unusual way.

I hope that I have stated the problem clear enough for you to understand and I am sorry if I have posted this in the wrong place, I am new to Eclipse forum and find it a bit difficult to navigate to an appropriate sub-forum.

Thanks in advance.
Re: Deployment Descriptor & web.xml (Servlet programming) [message #1006115 is a reply to message #1006100] Wed, 30 January 2013 00:24 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 01/29/2013 02:56 PM, Roman Yusupov wrote:
> Hello, I am new to Servlets and JSP. I have installed latest Eclipse
> (Juno) for Java EE development.
> I was going to make a simple Hello World dynamic web project using
> servlets.
>
> Anyway, I've created the HelloWorld servlet using the wizard and it has
> automatically placed it in the right folder and everything was neat.
> Then I wanted to do servlet mapping and noticed that there was a node
> called "servlet-mappings" under the Deployment Descriptor in the project
> tree. I double clicked a message in the editor that
> /WebContent/WEB-INF/web.xml did not exist. From there I have tried
> different solutions. If I create web.xml manually the Deployment
> Descriptor gets removed. So to generate web.xml I had to right-click on
> the Deployment Descriptor and choose "Generate Deployment Descriptor
> Stub" which generated some welcome-pages and a web.xml at the required
> location. (it took however Eclipse several minutes to figure out that
> web.xml has been created and not show the source not found message in
> the editor when I tried to look at the web.xml). Anyway, if I edit the
> web.xml manually once again the Deployment Descriptor gets removed, also
> there seems to be some strange bug that once I've manually created or
> edited the web.xml file Eclipse has trouble creating servlets with "new
> servlet" wizard. The problem is that even after I fill in the package
> and the class name the "next" and "finish" buttons remain unclickable.
> There is also a checkbox that lets you choose an already existing
> servlet when I check it all of the fields become disabled and when I
> uncheck the box all the fields remain disabled (so I basically can't do
> anything except closing the wizard).
>
> I know now that the servlet-mapping is done in @WebServlet(...) in the
> Servlet itself, but it seems reasonable that I should be able to
> manually edit web.xml without Eclipse going haywire like that and remove
> Deployment Descriptor (or perhaps it is supposed to be removed like
> that?) and prevent me from creating more servlets in such an unusual way.
>
> I hope that I have stated the problem clear enough for you to understand
> and I am sorry if I have posted this in the wrong place, I am new to
> Eclipse forum and find it a bit difficult to navigate to an appropriate
> sub-forum.
>
> Thanks in advance.

First, your question would fit better in the Eclipse web tools platform
forum. (That's for next time.)

Second, here's an old, but still working tutorial, exhaustive in its
explanations that you might find useful. It was written before
annotations (like @WebServlet) were introduced, but you might be able to
make use of it.

http://www.javahotchocolate.com/wtp-tutorials/wtp-tutorial.html

You can find many other, usually shorter tutorials, best are the ones at
http://www.vogella.de.

Best of luck.
Re: Deployment Descriptor & web.xml (Servlet programming) [message #1006116 is a reply to message #1006115] Wed, 30 January 2013 00:39 Go to previous message
Roman Yusupov is currently offline Roman YusupovFriend
Messages: 4
Registered: March 2012
Junior Member
Thanks, tutorials are always helpful since I'm new to this, but I don't know how well they would help with the issue I am facing. I do not seem to be doing anything wrong per se (partially following tutorial from a book called Servlets and JavaServer Pages by Jayson Falkner and Kevin Jones), but any time I edit the web.xml file Eclipse removes the Deployment Descriptor node and prevents me from creating servlets in the way described. So I am mainly wondering what would make Eclipse behave in such an unusual way and if there is a solution to that problem.
Previous Topic:Date/Time Format
Next Topic:Java sources of the main ?Swing? Eclipse Window
Goto Forum:
  


Current Time: Thu Apr 25 00:54:34 GMT 2024

Powered by FUDForum. Page generated in 0.07942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top