Actually the form tag fails even more spectacularly than I suspected... as things like <s:label tags nested in the form are not even localized.

Looks like Stripes wants to be smart and ensure that URLs map directly to ActionBean's but that would make sense if Stripes offered full fledged Localization support on UrlBindings (sure one could make shell nested subclasses but that is ugly as it hard codes localization vs. having it in re-loadable property files).

Perhaps what we need is an option on the form tag that signals to Stripes to ignore the fact that there is no match to an ActionBean and don't worry about it b/c the developer knows what they are doing. Because although the default error behaviour is nice it doesn't make sense with URI localization... .

In any event, would be interested in other people's thoughts / solutions... .

--Nikolaos



Nikolaos Giannopoulos wrote:
Hi,

*/_Setup:_/
*
- ShareActionBean with @UrlBinding("*/share/*{uuidRadix}/{titleUrlified}/{$event}")

- UrlRewriteFilter that pre-processes requests and maps say the Spanish URL:
  */compartir/0/_/anadir*  ==>  */share/0/_/add*

/_*Flow:*_/

- User request:  */compartir/0/_/anadir*

- UrlRewriteFilter forwards to:  */share/0/_/add*

- ShareActionBean event handler simply does:
return (new* ForwardResolution*("/WEB-INF/jsp/content/*share_form.jsp*"));

- *share_form.jsp* relevant snippet contains:
    *<s:form* *action="${actionBean.formUrlBinding}"* method="POST">
         <s:text name="share.title" />
         <s:hidden name="*tokenKeyTx*" />
         <s:submit name="yes" /><s:submit name="no" />
*    </s:form>*

- *${actionBean.formUrlBinding}* resolves to */compartir/0/_ *so the form tag ends up looking like:
   <form action=" */compartir/0/_*" method="POST">
        <input type="text" name="share.title" value="" />
        <input type="hidden" name="*tokenKeyTx*" value="" />
<input type="submit" name="yes" value="yes" /><input type="submit" name="no" value="no" />
*   </form>

*- Now, what happens next was somewhat unexpected... as soon as the form tag is processed the following error comes up:

ERROR net.sourceforge.stripes.tag.FormTag.error - Could not locate an ActionBean that was bound to the URL [/compartir/0/_]. Without an ActionBean class Stripes cannot determine whether the ActionBean is a wizard or not. As a result wizard behaviour will be disabled.

- While I understand that Stripes is trying to make a 1-to-1 association between the form action and an existing URL binding the problem is that the error appears to affect the binding of the "tokenKeyTx" hidden field in the form in that it ends up with a value of "" instead of its true value "83e32-32435254-sjfi-asbsdrwq".

I could probably live with an error being logged but why does Stripes make this such a serious offence AND in light of localization isn't this a problem???

I see 2 immediate workarounds to this problem though both aren't great:

1) Use non-localized action URL in the form but then I would need to override Source page resolution b/c if there is an error in say user input the user must be redirected to the localized version of the URL and not the non-localized version. As well in order to maintain the localized URL which could contain an id for example (say doing edit) we would need to add a hidden form field for the localized URI... this smells in that the URL in the action is non-localized and although not directly visible to the user still appears silly to be part of a fully localized web app and then we pack a hidden localized URI. Uuuggghhh...

2) Add URL bindings for localized versions. This is not viable as we are using UrlRewriteFilter to abstract localization from our components and have invested heavily to abstract as much of that away from Stripes as possible.

Thoughts? Other Solutions? Is this a flaw? Bug (in light of localization)?

Thanks,

--Nikolaos

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to