You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Miguel Almeida <mi...@almeida.at> on 2013/10/02 19:04:13 UTC

s:token doesn't accept data- attributes, cssClass ignored

Hi,

I am creating an ajax call for a method which is protected by the
TokenSessionStoreInterceptor. This means I need to pass the token onto
the request.

I was expecting the s:token tag to accept data-foo="bar" attributes
(they'd be passed along to the corresponding hidden elements), but this
is not happening (I'd use this so I could retrieve the inputs with a
simple jquery select .find(":input[data-scope='save'], which retrieves
me all the needed inputs as long as I mark them with that data-scope ).

My 2nd attempt was also unsuccessful - while <s:token
cssClass="someclass"/> doesn't break rendering, the class is not passed
onto the hidden input elements.

Is there a reason for this? While in the case of data-foo this seems to
be a missing feature, in the case of cssClass it's also misleading - you
can set the property, but it doesn't have any consequence.

Miguel

Re: s:token doesn't accept data- attributes, cssClass ignored

Posted by Lukasz Lenart <lu...@apache.org>.
2013/10/2 Miguel Almeida <mi...@almeida.at>:
> Hi,
>
> I am creating an ajax call for a method which is protected by the
> TokenSessionStoreInterceptor. This means I need to pass the token onto
> the request.
>
> I was expecting the s:token tag to accept data-foo="bar" attributes
> (they'd be passed along to the corresponding hidden elements), but this
> is not happening (I'd use this so I could retrieve the inputs with a
> simple jquery select .find(":input[data-scope='save'], which retrieves
> me all the needed inputs as long as I mark them with that data-scope ).
>
> My 2nd attempt was also unsuccessful - while <s:token
> cssClass="someclass"/> doesn't break rendering, the class is not passed
> onto the hidden input elements.
>
> Is there a reason for this? While in the case of data-foo this seems to
> be a missing feature, in the case of cssClass it's also misleading - you
> can set the property, but it doesn't have any consequence.

The problem is that, it base on AbstractUITag and inherits all those
commons attributes, but token.ftl doesn't use them at all - I now,
it's misleading.

You can try define your own /template/simple/token.ftl with additional
parameters or feel free to register an issue.


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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