|Re: Deployment Descriptor & web.xml (Servlet programming) [message #1006115 is a reply to message #1006100]
||Wed, 30 January 2013 00:24
| Russell Bateman
Registered: July 2009
Location: Provo, Utah, USA
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
> 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
> 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.
You can find many other, usually shorter tutorials, best are the ones at
Best of luck.
Powered by FUDForum
. Page generated in 0.02857 seconds