• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem with the request dispatcher

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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";);

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.
Posts: 43016
  • 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.
I don't even know how to spell CIA. But this tiny ad does:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic