Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp get param from servlet  RSS feed

 
marko stone
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2 questions
1.i want refresh my jsp page when servlet will full loaded
how i can track it ?
2. this jsp get some parameter from servlet
in servlet i use
RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/MyJSP.jsp?param1="+value);
dispatcher.forward(req,res);
how i can get it in JSP ?
thanks
 
Ken Robinson
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not totally understand the first question, but I can answer the second.
Before you forward via the RequestDispatcher, you can put object in the Request object.
Request.setAttribute(key, value) puts an object in the request. In your JSP, you can get the object out using the <jsp:useBean ...> tag as well as the JSTL <req:attribute...> tag or any other JSP tag written for this purpose.
Check out the book Java Server Pages, 2nd Edition by Hans Bergsten from O'Reilly, it is very good.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!