wood burning stoves 2.0*
The moose likes Servlets and the fly likes how to pass some variables to jsp from servlet using RequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to pass some variables to jsp from servlet using RequestDispatcher" Watch "how to pass some variables to jsp from servlet using RequestDispatcher" New topic
Author

how to pass some variables to jsp from servlet using RequestDispatcher

Ravii Bhai
Greenhorn

Joined: Dec 13, 2008
Posts: 10
I m getting difficulty to pass values from servlet to jsp when i m using Request Dispatcher
RequestDispatcher rd = getServletContext().getRequestDispatcher("/salcal2.jsp");
rd.forward(request, response);

how to read all values of servlet at jsp page

reply urly...

thank you
Ravi
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
You can always pass it via request scope. Something like:
In servlet, before you forward to the JSP page. Providing that you have a variable object named myvar


On the JSP page to get the variable property (i.e. say getMyProperty() method in myvar object).



Hope it help.


“Everything should be as simple as it is, but not simpler.” Albert Einstein
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to pass some variables to jsp from servlet using RequestDispatcher
 
Similar Threads
Passing Control from JSP to Servlet
How to manually invoke jsp servlet?
jsp:useBean standard action doubt
RequestDispatcher not working properly in Websphere
URGENT!!!!