Forums Register Login

/test/GreetingServlet doesn't work

+Pie Number of slices to send: Send
Hi,

I am using NetBeans 6 to configue a servlet. The Tomcat server is bunded within NetBeans. So it is not necessary to set up classpath and copy folders etc as with Eclipse.
I followed the totorial, it does work. However if I modified it a little.
index.jsp is

web,xml is


If I go to http://localhost:8080/test/GreetingServlet
I got


Why?
Thanks
[ January 23, 2008: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
"test" is your contextPath (web application name) so you shouldn't need to include it in your servlet-mapping.

Change it to:
<url-pattern>/GreetingServlet</url-pattern>
and see if that fixes it.

Once you get past this, you should see our article on creating context relative paths.
http://faq.javaranch.com/java/ResourceUrls

This is a much better way to go than hard coding the contextPath in your URLs.
+Pie Number of slices to send: Send
It is still not working.
I modified it in many combinations.
In web.xml, or index.jsp and context.xml.


Thanks for your advice.
+Pie Number of slices to send: Send
 

Originally posted by Hui Zhao:
It is still not working.
I modified it in many combinations.
In web.xml, or index.jsp and context.xml.
...



This doesn't give us a lot with which to work.

What is the full path to your index.jsp page on your hard drive, starting with the drive letter?
+Pie Number of slices to send: Send
What does your servlet-mapping entry look like now?

You should not have to modify context.xml for this to work.
+Pie Number of slices to send: Send

The full path of index.jsp is in
+Pie Number of slices to send: Send
Ben's first post explained why that doesn't work. Did you implement the fix he suggested?
+Pie Number of slices to send: Send
I have changed it.


But when I deployed it. I got
+Pie Number of slices to send: Send
Personally, I recommend that people starting out learning servlets put their IDE aside until they are comfortable writing, compiling, and deploying at least a simple 'Hello, World' program in a spec compliant container like Tomcat.

I don't know how Netbeans is deploying your apps within Tomcat so I can't be of much help to you.
I'm going to move this thread to our IDEs forum where you stand a better chance of finding someone who knows what it does.
no wonder he is so sad, he hasn't seen this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1061 times.
Similar Threads
/test/GreetingServlet doesn't work
unable to display bean property using ArrayList
Unable to understand the flow of simple app
Unable to find taglib in project--please help
Failed to load or instantiate TagLibraryValidator
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:45:31.