File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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();
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.getRequestDispatcher(target).forward(request, response);

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().

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:
subject: sendRedirect() in Tomcat?
It's not a secret anymore!