I am running jsp in jakarta/tomcat as a stand alone and am having the following problem.
I have a form that has the following tag
<FORM name='NewSelections' method="post" action="/servlet/com.servlets.MainController"
the doPost in the servlet lands on the following actions
doPost(r,r)
{ ... do things
String nextPage = "customer.jsp"
ServletContext context = getServletContext();
RequestDispatcher rd = context.getRequestDispatcher(nextPage);
rd.forward(request, response);
}
The flow is I'm in the customer.jsp, as a result of a submit, I want to do some work in the doPost of the servlet and go right back to the customer.jsp page with an adjusted set of data. so its customer.jsp, using action /servlet/com.servlets.MainController and the MainController forwarding back to the customer.jsp. That is the flow ...
The problem is, I think maybe in the jarkarta configuration based on the following evindence.
when the customer.jsp is in its docs subdirectory the attempt to call the servler results in an error that says
docs/servlet/com.servlets.MainController not found. So it starts looking for the servet in the sub directory of the .jsp files instead of in the classes directory under web-inf
if I move the customer.jsp file to the top of the application directory so its in /%catalina_home%/webapps/dispatch (where dispatch is the name of the application) then I can execute the servlet on submit, once.
when more changes are made to the form and I hit submit the second time. I have the same problem where the servlet is not found and the path is like this
dispatch/servlet/servlet/com.servlets.MainController resource not available.
another interesting note is that after the forward from the servlet, although I am in the form, the url in the browser says
it doesn't say customer.jsp as I expected.
my web.xml is configured to have this one servlet like this
<servlet>
<servlet-name>MainController</servlet-name>
<servlet-class>com.webware.servlets.MainController</servlet-class>
</servlet>
which seems pretty straight forward.
I think I'm missing something really small either in tomcat configuration or in the foward or something. I'm not sure what...
can anyone help, I need to solve this really really quickly ...
thanks
niblet
I have a form that has the following tag
<FORM name='NewSelections' method="post" action="/servlet/com.servlets.MainController"
the doPost in the servlet lands on the following actions
doPost(r,r)
{ ... do things
String nextPage = "customer.jsp"
ServletContext context = getServletContext();
RequestDispatcher rd = context.getRequestDispatcher(nextPage);
rd.forward(request, response);
}
The flow is I'm in the customer.jsp, as a result of a submit, I want to do some work in the doPost of the servlet and go right back to the customer.jsp page with an adjusted set of data. so its customer.jsp, using action /servlet/com.servlets.MainController and the MainController forwarding back to the customer.jsp. That is the flow ...
The problem is, I think maybe in the jarkarta configuration based on the following evindence.
when the customer.jsp is in its docs subdirectory the attempt to call the servler results in an error that says
docs/servlet/com.servlets.MainController not found. So it starts looking for the servet in the sub directory of the .jsp files instead of in the classes directory under web-inf
if I move the customer.jsp file to the top of the application directory so its in /%catalina_home%/webapps/dispatch (where dispatch is the name of the application) then I can execute the servlet on submit, once.
when more changes are made to the form and I hit submit the second time. I have the same problem where the servlet is not found and the path is like this
dispatch/servlet/servlet/com.servlets.MainController resource not available.
another interesting note is that after the forward from the servlet, although I am in the form, the url in the browser says
it doesn't say customer.jsp as I expected.
my web.xml is configured to have this one servlet like this
<servlet>
<servlet-name>MainController</servlet-name>
<servlet-class>com.webware.servlets.MainController</servlet-class>
</servlet>
which seems pretty straight forward.
I think I'm missing something really small either in tomcat configuration or in the foward or something. I'm not sure what...
can anyone help, I need to solve this really really quickly ...
thanks
niblet