• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

one servlet works the other doesn't?

 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Ok I have one jsp it accesses servlet one like this:
<form name="form" method="post" action="test">
This works all just fine and dandy. In side servlet one my doPost method works just great!
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
checkInfo(request, response);
}
The checkInfo method does some dataBase work and takes me to my second jsp page.
Jsp page two accesses servlet two like this.
<form name="form" method="post" action="userControl">
When I click on the button to submit this page to the server I imediately get 404.
This is the doPost method of the second servlet.
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
changeUser(request, response);
}
I am doing this in my dev environment, which is jbuilder5 it has tomCat built into it. Both of the servlets compile into class files.
If I access the 2nd servlet from a webBrowser it also says not found.
Any tips?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
404 implies that your second servlet can't be found which agrees with your attempt from the browser. Right off hand I guess you have not set the web.xml file up correctly.
Are these servlet classes in a package? Tomcat works much better if they are.
Bill
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for the reply. Yes these servlets are both in a package. They are in the same package and their classes are in the dir. I am using jbuilder5 which sets up the deployment descriptor for me as I create servlets just in the same way websphere does as u add a servlet to a webApplication.
Here is the deployment discriptor that was created by jbuilder for these servlets
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>loop.test</servlet-class>
</servlet>
<servlet>
<servlet-name>userControl</servlet-name>
<servlet-class>loop.userControl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>usercontrol</servlet-name>
<url-pattern>/usercontrol</url-pattern>
</servlet-mapping>
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works great now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic