 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Rose Girl Guest
|
Posted: Wed Jun 09, 2004 4:29 am Post subject: Java Help - Servlet |
|
|
Hi
I am using the response.sendRedirect(url) method. url is path to
another servlet. Example:
response.sendRedirect(response.encodeRedirectURL
("/EcBugManager/servlet/bugmanager.bugmanager.gui.BugsheetPage?
type="+bugsheetType+"&page="+page);
I am using the response.encodeRedirectURL to encode the url as i dont
want the parameters to be seen in the explorer - address bar.
?? But nothing happens, it just returns the same string with all the
paramteers without being encoded.
Am i using the correct way to encode the url, or is there another way
to do it.
Please, help me on this
Thanks for your time
Rose.
|
|
| Back to top |
|
 |
Charles Fineman Guest
|
Posted: Thu Jun 10, 2004 12:57 am Post subject: Re: Java Help - Servlet |
|
|
The "encode" calls are to remove special characters from the url so it
parses correctly... it has nothing to do with whether it shows up in the
browser or not. In your example, there are no characters to convert so
it returns it's argument (see my excerpt from the javadoc below).
The "encodeRedirectURL" also will stick cookie values in the request if
the browser does not support cookies.
As far as I know, when redirect is used, it shouldn't show in the
browser anyway (but different browsers may respond differently to
a redirect)
From JavaDoc:
public java.lang.String encodeRedirectURL(java.lang.String url)
Encodes the specified URL for use in the sendRedirect method or, if
encoding is not needed, returns the URL unchanged. The implementation of
this method includes the logic to determine whether the session ID needs
to be encoded in the URL. Because the rules for making this
determination can differ from those used to decide whether to encode a
normal link, this method is seperate from the encodeURL method.
All URLs sent to the HttpServletResponse.sendRedirect method should
be run through this method. Otherwise, URL rewriting cannot be used with
browsers which do not support cookies.
Rose Girl wrote:
| Quote: | Hi
I am using the response.sendRedirect(url) method. url is path to
another servlet. Example:
response.sendRedirect(response.encodeRedirectURL
("/EcBugManager/servlet/bugmanager.bugmanager.gui.BugsheetPage?
type="+bugsheetType+"&page="+page);
I am using the response.encodeRedirectURL to encode the url as i dont
want the parameters to be seen in the explorer - address bar.
?? But nothing happens, it just returns the same string with all the
paramteers without being encoded.
Am i using the correct way to encode the url, or is there another way
to do it.
Please, help me on this
Thanks for your time
Rose.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|