This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to pass some variables to jsp from servlet using RequestDispatcher

 
Ravii Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic