Hi all,

Here is a very simple tag. It's role is to add session encoding to its
parameter if the client browser doesn't support cookies.

In the majority of cases, you don't need it because <link> and <forward> do
it already. I had the need for it when my application opens a new window
from JavaScript to present messages to the user:

<script language="JavaScript" type="text/javascript">
    window.open('<s:encodeURL href="error.do?action=1243" />');
</script>

Add the following declaration to your struts.tld file:

    <tag>
        <name>encodeURL</name>
        <tagclass>org.apache.struts.taglib.EncodeURLTag</tagclass>
        <bodycontent>EMPTY</bodycontent>
        <info>Encodes the URL given as parameter, adding session information
if necessary</info>
        <attribute>
            <name>href</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>

Hope this helps.

Pierre Métras

EncodeURLTag.zip

Reply via email to