Unable to send request to Servlets
Hi,
I have two servlets; /Login and /ShoppingCart
I make a POST request to the login servlet. The post method of the login servlet does some username-userpassword checking on the database and if successful, forwards the request onto the shoppingcart servlet.
I've been using the RequestDispatcher.forward(request, response) method to forward the request onto the shoppingcart servlet but it keeps going to the POST method of the shoppingcart servlet (I want to forward to the GET method).
I've seen a few solutions to this problem and it seems to be to just call the 'doGet' method in the doPost method but I cannot do this as I have an implementation for the POST method.
Can anyone point me to a solution to my problem? Thanks in advance
Re: Unable to send request to Servlets
I got it to work by puttiing the program DBHandler in package: forms and added the following to the web.xml file in Norms/WEB-INF/
Code:
<servlet>
<servlet-name> DBHandler </servlet-name>
<servlet-class> forms.DBHandler </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> DBHandler </servlet-name>
<url-pattern> /servlet/DBHandler </url-pattern>
The path to the class file is:
"C:\Archivos de programa\Apache Software Foundation\Tomcat 5.5\webapps\Norms\WEB-INF\classes\forms\DBHandler.class"
Re: Unable to send request to Servlets
As a rule, you can only forward between components in the same web container. Since the IPlanet servlet and the Weblogic JSP are in different JVMs, the forward operation fails.
If possible, I suggest you switch to a client-side redirect: response.sendRedirect(). That should work regardless of where the components are located.
Re: Unable to send request to Servlets
If you can forward to a "real" JSP in weblogic, why don't you create a "/signatureok.jsp" JSP, and then have the JSP forward to your servlet. That way, your forward operation happens in a single container.