I fail to understand how to use the "encode" attribute of the <s:url>.
Here's an example that puzzles me...  Let's try, alternately, to set
"encode" to "true" and "false".  Here goes:

   <s:url action="myAction" namespace="/" encode="true"><s:param
name="entityName">Élizabeth</s:param></s:url>

yields:

    /myAction?entityName=%C3%83%C2%89lizabeth

while

   <s:url action="myAction" namespace="/" encode="false"><s:param
name="entityName">Élizabeth</s:param></s:url>

yields

    /myAction?entityName=%C3%83%C2%89lizabeth

which is exactly identical to the previously generated URL!
Therefore what is the point of the "encode" attribute?

Moreover, when 'myAction' retrieves the 'entityName' parameter, it
converts it to: "Élizabeth".
???

BTW, when Google encodes the query string "Élizabeth" (without the
quotes), it does so as:
http://www.google.com/search?q=%C9lizabeth

* * *

My setup:
Tomcat 6.0.16, Java1.6.0_11, Struts 2.1.6
<constant name="struts.i18n.encoding" value="UTF-8"/>

The JSP page where the <s:url> tag appears contains the following
lines (each in its proper place):
<%@ page contentType="text/html;charset=UTF-8" language="java"
pageEncoding="UTF-8" %>
<?xml version="1.0" encoding="UTF-8"?>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>

I have a Tomcat encoding filter that sets each request's encoding to:
"text/html;charset=UTF-8"

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to