On 7/26/06, Don Brown <[EMAIL PROTECTED]> wrote:
The URL tag isn't meant to be used with a query string.  The best way to write
this would be:

<s:url action="Welcome">
  <s:param name="request_locale" value="en" />
</s:url>

Well, since "en" is a constant, and not a stack reference, it needs to
be quoted or parametized itself.

Here's three idioms that work:

<h3>Language Options</h3>
<ul>
   <li>
       <s:url id="en" action="Welcome">
           <s:param name="request_locale">en</s:param>
       </s:url>
       <s:a href="%{en}">English</s:a>
   </li>
   <li>
       <a href="<s:url action="Welcome">
           <s:param name="request_locale" value="'ru'"/>
       </s:url>">Russian</a>
  </li>
   <li>
       <a href="<s:url value="Welcome.do">
           <s:param name="request_locale" value="'ja'" />
           </s:url>">Japanese</a>
   </li>
</ul>

I believe the first form ("en") is preferred, the second is OK, and
the third ("ja") would be considered sub-nominal practice, since it
embeds the extension in the URL (which could be changed in the
configuration).

We use the third form a few times in the Showcase, and I'll make a
point to replace them with preferred forms before the next snapshot.

I think I might want to add a "taglib examples" module to the
Showcase, that just demonstrated the preferred idioms straight-up,
something like what we have for Struts 1, but just as a usage key,
rather than a testing device.

* http://planetstruts.org/struts-examples/exercise/

-Ted.

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

Reply via email to