• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with the request dispatcher

 
suneel kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic