permaculture playing cards
The moose likes Servlets and the fly likes Trouble with controller servlet mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trouble with controller servlet mapping" Watch "Trouble with controller servlet mapping" New topic

Trouble with controller servlet mapping

Dave Thomas
Ranch Hand

Joined: Nov 05, 2001
Posts: 30
I'm trying to get a controller pattern happening using servlet mapping but am having a little trouble. Heres an excerpt of my web.xml:
This line in my jsp file:
<form action="login" method="POST">
returns a 404 error. Resource not found.
Why do you suppose this is.
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Originally posted by Caveman Thomas:

<form action="login" method="POST">

Try action="/login"
Am not testing it, but as far as I remember without / syntax results in relative link from the document you are in. So if your jsp is in caveAppRoot/jsp/ directory it searches there for the servlet.

With /login the link is relative to context root. So it should find the servlet indicated in the dd.
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
CT - See my last post in the other discussion.
If you still have web.xml in:
TOMCAT_HOME/appname, then startup is not reading it!!
It needs to be in:
Regards, Guy
Just out of curiosity, what is your delta off of GMT?
[ March 14, 2002: Message edited by: Guy Allard ]
Dave Thomas
Ranch Hand

Joined: Nov 05, 2001
Posts: 30
Thanks Guy. I actually do have the web.xml file under WEB-INF and everything seems to be cool in that department. Beans, servlets and jsps are working fine. (Not sure what the delta off GMT is but I can tell you that right now its too late to work it out. Its 2am here now.)
Still am having a problem with the mapping though. You are right Axel. The action does need a "/" in front but now I have a different message. ie: HTTP Status 503 - Servlet maincontroller is currently unavailable.
I have the ControllerServlet in the classes dir.
[ March 14, 2002: Message edited by: Caveman Thomas ]
Dave Thomas
Ranch Hand

Joined: Nov 05, 2001
Posts: 30
OK. I've worked it out. The action needed to be:
Thanks again.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Trouble with controller servlet mapping
It's not a secret anymore!