aspose file tools*
The moose likes Servlets and the fly likes Problem with the request dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with the request dispatcher" Watch "Problem with the request dispatcher" New topic
Author

Problem with the request dispatcher

suneel kumar
Ranch Hand

Joined: Jan 08, 2007
Posts: 46
Hi
I have a problem with the servlets and JSP.I want to communicate with the two systems using servlets and jsps.
1)In my first jsp (a.jsp) i have one text box and one submit button.
when i submit the form it is going to one servlet(Aservlet.java which is in my machine).
2)From the Aservlet.java i am using
RequestDispatcher rd = context.getRequestDispatcher("http://ipnumber:8080/b.jsp");
rd.forward(request,response);

3)Problem is while doing this one i am getting exception like request dispatcher must start with "/".
4)Instead of this if i use response.sendRedirect i am able to see the other machine b.jsp., but i am unable to get the same request what i have sent from Aservlet.java.

5) So, i just want to request one servlet on other machine and at the same time i need to access the request object on the other system

can any one guide me to this.

thanks in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
That's not possible. RequestDispatchers only work within one web application, not across servers.

If you need to pass parameters in a redirect you can append them to the URL, like http://ipnumber:8080/b.jsp?param1=value1¶m2=value2. They will be visible in the browser URL field, though.


Ping & DNS - my free Android networking tools app
 
 
subject: Problem with the request dispatcher