Except that you're talking about "escaped encoding", not rewriting. The encodeURL method is misnamed, it actually does rewriting by potentially adding a session id. java.net.URLEncoder.encode does encoding, but of the type that makes sure strings are in application/x-www-form-urlencoded MIME format for form submission. Escaped encoding ensures a string doesn't contain any illegal characters for a URI (like spaces). Here's a test JSP:

<%@ page contentType="text/plain" %>
<%
out.println(response.encodeURL("/foo bar"));
%>

When hit the first time under TC 4.1.24 w/JDK 1.4.1:

/foo bar;jsessionid=D4FF74D6A3D890B6018E93B0FE35EDBE

Which isn't really what you want in your forward path, right? In most cases, encodeURL probably won't include the session id since a cookie-based session will already exist. I don't see that it also handles escape encoding, however. I assume that has to be done by hand, although there's got to be a utility somewhere to do it. JavaScript's escape function does this sort of thing...

Wendy Smoak wrote:

Kris wrote:

Forget the call to encodeURL, you don't need it


I was unable to use the ActionForward( String path ) constructor without
encoding. One of the parameters has spaces in it, and once I changed them
to %20, all was well.


This was one of the early parts of the project, before I had a clue what I
was doing... (now I have a few more, but not enough!)  I was introduced to
Struts-EL later.  I'll go back and see if I can use <html-el:form> instead
of a plain-old HTML form (and JSTL).

Thanks for your help,

-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to