Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect() in Tomcat?

 
Pourang Emami
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying the following code in Tomcat(4) when the request gets to the target jsp, there is no QueryString(prmPage=value1) attached to the request?
(it works fine with OC4J though)
How I can send parameters with senRedirect in Tomcat?
String path= request.getRequestURL().toString();
response.sendRedirect(path+"?prmPage=value1");
Thank you
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thing, you should be use HttpServletRequest.getRequestDispatcher() method which it's work.
Example ;
request.setAttribute(.....);
request.getRequestDispatcher(target).forward(request, response);
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, only a request contains parameter, cos you wanna send sth to the server for processing. After the process, the server returns the data to you, maybe text, html, whatever. However, it does not need a query string, as all info are inside the result already.
So, maybe you need to think whether you really need reponse.sendRedirect().
Nick.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic