GeeCON Prague 2014*
The moose likes JSP and the fly likes sendRedirect() in Tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "sendRedirect() in Tomcat?" Watch "sendRedirect() in Tomcat?" New topic
Author

sendRedirect() in Tomcat?

Pourang Emami
Ranch Hand

Joined: Sep 21, 2002
Posts: 127
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


Best Regards,<br />Pourang Emami
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
I thing, you should be use HttpServletRequest.getRequestDispatcher() method which it's work.
Example ;
request.setAttribute(.....);
request.getRequestDispatcher(target).forward(request, response);


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
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.


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sendRedirect() in Tomcat?