Author
Been troubleshooting for 3 days: Servlet doesn't work
Moe Cosby
Greenhorn
Joined: Dec 10, 2010
Posts: 3
I am new to JSP/Servlet scene but I have been in I.T field for good couple of years.
For the end of me - I cannot run HELLO WORLD servlet on Tomcat 7
I been suspecting that its illconfigured web.xml file - hence I have tried many HELLO WORLD servlet and they don't work either
Although builtin example works.
For code + exact error details - lets just say this one is exactly describing my issue but it is not working: http://www.daniweb.com/forums/thread186788.html
I can compile it successfully and I can open it through tomcat.
I have tried importing WAR files - doesn't work
Created new files - doesn't work
Copied other people's project - doesn't work
Any help is appreciated.
Note - this is local development environment. A lot of time it is not connected to internet either. Security is not a concern.
binu narayanan
Ranch Hand
Joined: Jul 24, 2009
Posts: 56
Hi,
If the address in your browser is some thing like this http://localhost:8084/myservlet . This url would like this if you are using Netbeans IDE.
Then changing the code in your jsp from <FORM action="/myServlet" method="GET"> to
<FORM action="[YOUR PROJECT NAME ]/myServlet" method="GET">
will help you call your servlet
Binu Narayanan
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted Dec 11, 2010 01:06:36
0
"it doesn't work" is not a helpful problem description - see ItDoesntWorkIsUseless and TellTheDetails .
You could also check out how the examples in the "servlets-examples" web app work that comes with Tomcat.
Moe Cosby
Greenhorn
Joined: Dec 10, 2010
Posts: 3
^ LOL
As I mentioned in my original post (see the link for details of code + error) - My problem is EXACTLY the same.
but my solution is not.
@Binu - I will try that and report back on Monday.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
"Prince Ms", please check your private messages for an important administrative matter. Thanks.
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Prasad Krishnegowda
Ranch Hand
Joined: Apr 25, 2010
Posts: 503
In that link, they also tell that the problem is solved.. Can, you please tell the exact details of your problem.. I wonder why can't you tell your problem with your code here, instead of showing us the link.. this also helps to get more responses to your question..
Regards, Prasad
SCJP 5 (93%)
Chetan Natu
Greenhorn
Joined: Dec 03, 2005
Posts: 19
Have you tried by dropping the "/" in the Form action? I think this will work...
Never Remember the failure
Never Forget the mistake
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
If you want, in my signature there is a tutorial for hello world with servlet.
It might help you.
[uaiHebert.com ] [Full WebApplication JSF EJB JPA JAAS with source code to download ] One Table Per SubClass [Web/JSF ]
Moe Cosby
Greenhorn
Joined: Dec 10, 2010
Posts: 3
Thanks everyone. Mark this as resolved.
Removed all tomcat(s). Reinstalled tomcat 7. Checked all paths. Recreated all files from scratch in notepad (no copy paste). Working now.
[Although Servlet are more powerful - I prefer Microsoft ASP, you end up spending more time in developing solution than learning / troubleshooting :s ]
subject: Been troubleshooting for 3 days: Servlet doesn't work