GeeCON Prague 2014*
The moose likes Servlets and the fly likes How do you pass a string from servlet to jsp if jsp is on another server? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How do you pass a string from servlet to jsp if jsp is on another server?" Watch "How do you pass a string from servlet to jsp if jsp is on another server?" New topic
Author

How do you pass a string from servlet to jsp if jsp is on another server?

Cherry Gupta
Greenhorn

Joined: Feb 09, 2010
Posts: 17
How do you pass a string from servlet to jsp if jsp is on another server?

Please provide me solution for this.

Thanks
Cherry
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Use the query string with the JSP and redirect to the URL., like


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Cherry Gupta
Greenhorn

Joined: Feb 09, 2010
Posts: 17
thanks Sagar for quick response

but stil I m not able to get that how I set a string in servlet and get that in jsp if jsp is on another server?

please provide me some kind of code for it.

Thanks
Cherry
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I told you to use the "query string" and to access it in the JSP page use request.getParameter(). EL for the same:


William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
Exactly what sequence of events are you trying to create here?

If you want the servlet to redirect to the other server, you have to use a URL containing the parameter like Sagar said. See the HttpServletResponse sendRedirect() and encodeRediretURL() methods.

If you have some other sequence of events in mind, kindly explain.

Bill
amrish sharma
Greenhorn

Joined: Sep 24, 2009
Posts: 20
as sagar said now at another server jsp page code
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

amrish sharma wrote:request.getparametre('param').toString().trim();

If you are going to post code, please make sure that it is accurate. The spelling of the method is getParameter() not "getparametre", and strings must be in double quotes, not single quotes.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sarbjeet sidhu
Greenhorn

Joined: Jan 24, 2010
Posts: 11
Hi,

Please create output and set the value that you want to send to next server hidden field in it. and on load of the of that html page redirect to the server url.




Thanks
Sarbjeet Singh Sidhu
amrex sharma
Greenhorn

Joined: Sep 14, 2013
Posts: 1
right but you have to flush
gudadawar de
Greenhorn

Joined: Sep 26, 2013
Posts: 1

 
GeeCON Prague 2014
 
subject: How do you pass a string from servlet to jsp if jsp is on another server?