You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@spamgourmet.com on 2012/05/25 20:58:39 UTC

Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

After installing Struts 2.3.4, it appears that dynamic attributes must be strings now?

I've modified text.ftl in my custom theme like this (diff output):
23c23
< <input type="${parameters.type?default("text")}"<#rt/>
---
> <input type="text"<#rt/>
46,54d45
< <#if parameters.required?default(false)>
<  required="true"<#rt/>
< </#if>
< <#if parameters.autofocus?default(false)>
<  autofocus="autofocus"<#rt/>
< </#if>
< <#if parameters.pattern?? >
<  pattern="${parameters.pattern?html}"<#rt/>
< </#if>
62c53
< />


So that I can use dynamic attributes / HTML5 goodness like this:

<@s.text type="email" key="user.email" required=true autofocus=true />

But now Struts 2.3.4 blows up with this message:


Method public java.lang.String org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String) threw an exception when invoked on org.apache.struts2.util.StrutsUtil@540948a7
The problematic instruction:
----------
==> assignment: value=struts.translateVariables(keyValue)!keyValue [on line 27, column 3 in /themes/simple/dynamic-attributes.ftl]
 in include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on line 52, column 1 in /themes/simple/text.ftl]
 in include "/${parameters.templateDir}/simple/text.ftl" [on line 25, column 1 in /themes/my-custom-theme/text.ftl]
----------

I made sure to update my simple theme, perhaps I missed some template files?  Can anyone help?

Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Chris Pratt <th...@gmail.com>.
Try surrounding the attributes in quotes (e.g. "true" instead of true).
  (*Chris*)

On Fri, May 25, 2012 at 11:58 AM, <st...@spamgourmet.com> wrote:

> After installing Struts 2.3.4, it appears that dynamic attributes must be
> strings now?
>
> I've modified text.ftl in my custom theme like this (diff output):
> 23c23
> < <input type="${parameters.type?default("text")}"<#rt/>
> ---
> > <input type="text"<#rt/>
> 46,54d45
> < <#if parameters.required?default(false)>
> <  required="true"<#rt/>
> < </#if>
> < <#if parameters.autofocus?default(false)>
> <  autofocus="autofocus"<#rt/>
> < </#if>
> < <#if parameters.pattern?? >
> <  pattern="${parameters.pattern?html}"<#rt/>
> < </#if>
> 62c53
> < />
>
>
> So that I can use dynamic attributes / HTML5 goodness like this:
>
> <@s.text type="email" key="user.email" required=true autofocus=true />
>
> But now Struts 2.3.4 blows up with this message:
>
>
> Method public java.lang.String
> org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String)
> threw an exception when invoked on
> org.apache.struts2.util.StrutsUtil@540948a7
> The problematic instruction:
> ----------
> ==> assignment: value=struts.translateVariables(keyValue)!keyValue [on
> line 27, column 3 in /themes/simple/dynamic-attributes.ftl]
>  in include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on
> line 52, column 1 in /themes/simple/text.ftl]
>  in include "/${parameters.templateDir}/simple/text.ftl" [on line 25,
> column 1 in /themes/my-custom-theme/text.ftl]
> ----------
>
> I made sure to update my simple theme, perhaps I missed some template
> files?  Can anyone help?

Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Joby Joseph <jo...@almullagroup.com>.
Hi,

I want a help to pass the whole action form from JSP file to my action 
class. I have the action form and it contains the details. In my JSP file, 
some of the fileds is not used and I am setting the value to the form at the 
time of form loading. the form and all is in request scope. I want to get 
the whole form and its values in action class after submitting the page.

Please help me to find a solution for this


Regards,

Joby Joseph


----- Original Message ----- 
From: "Łukasz Lenart" <lu...@googlemail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, May 28, 2012 11:02 AM
Subject: Re: Dynamic Attributes can't be boolean? 
StrutsUtil.translateVariables exception


2012/5/25  <st...@spamgourmet.com>:
> From my perspective this represents a regression from 2.3.1.2, where what 
> I had previously worked fine.
> It could be due to FreeMarker change, since I also have this in my log:
>
> Caused by: freemarker.template.TemplateModelException: Argument type 
> mismatch; can not unwrap argument #1 (class: 
> freemarker.ext.beans.BooleanModel, toString: "true") to class 
> java.lang.String
> at 
> freemarker.ext.beans.SimpleMemberModel.createArgumentTypeMismarchException(SimpleMemberModel.java:175
> at 
> freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:123)
> at 
> freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:100)
> at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)

Probably you're right, but we upgraded FreeMarker because of some
security issues and we don't plan to revert it because of your
problem. So, you can stay with 2.3.1.2 and start migrate your
application.


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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





Disclaimer :

This e.mail message may contain confidential, proprietary or legally privileged information. It should not be used by anyone who is not the original intended recipient. If you have erroneously received this message, please delete it immediately and notify the sender. The recipient acknowledges that Al Mulla Group or its subsidiaries and associated companies*, are unable to exercise control or ensure or guarantee the integrity of / over the contents of the information contained in e.mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Al Mulla Group. Before opening any attachments please check them for viruses and defects.

* List of Companies covered under Al Mulla Group of Companies. 
1. Al Mulla Group Holding Co. K.S.C.C.
2. Bader Al Mulla & Brothers Co. W.L.L.
3. Saleh Jamal & Co. W.L.L.
4. Maseelah Trading Co. W.L.L.
5. Al Mulla Rental & Leasing of Vehicles & Equipment Co. K.S.C.C.
6. Al Mulla International Financing & Investment Co. K.S.C.C.
7. Al Mulla Cleaning & Maintenance Service Co. W.L.L.
8. Gulf Trading Group W.L.L.
9. Al Mulla Insurance, Reinsurance & Broking Co. W.L.L.
10. Al Mulla Consultancy Co. W.L.L.
11. Al Mulla Environmental Systems W.L.L
12. Al Mulla Real Estate 
13. Al Mulla Security Services Co. W.L.L.
14. Al Mulla International Exchange Co. K.S.C.C
15. Al Mulla & Behbehani Motor Co. W.L.L.
16. Al Mulla Building Construction Co. W.L.L.
17. Al Soor Financing & Leasing Co. K.S.C.C.
18. Larsen & Toubro Kuwait Construction & General Trading Co. W.L.L.
19. Kuwait Commercial Agency
20. Khadamat Marketing & Automotive Services Co.
21. Al Mulla General Trading for Safety, Security, & Fire Systems & Equipment Co. W.L.L.
22. Iraq International Import, Export & Commission Agent CO. W.L.L. (Iraq)
23. Al Mazayah Al Aulah General Trading Co. LLC (Dubai, UAE)
24. Al Mazayah Al Thania Car Trading LLC (Dubai, UAE)
25. AMG Steel & Systems Co. PVT LTD, (India)
26. Al Mulla Travel Bureau
27. Diamond International Motors Co. (Egypt)
28. Nasser Bin Khaled & Al Mulla Cars Rent Co. W.L.L. (SELECT RENTAL CAR), (Qatar)
29. Modern Exchange Co. (Oman)

#####################################################################################
Scanned by Brightmail
#####################################################################################


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


Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Łukasz Lenart <lu...@googlemail.com>.
2012/5/25  <st...@spamgourmet.com>:
> From my perspective this represents a regression from 2.3.1.2, where what I had previously worked fine.
> It could be due to FreeMarker change, since I also have this in my log:
>
> Caused by: freemarker.template.TemplateModelException: Argument type mismatch; can not unwrap argument #1 (class: freemarker.ext.beans.BooleanModel, toString: "true") to class java.lang.String
> at freemarker.ext.beans.SimpleMemberModel.createArgumentTypeMismarchException(SimpleMemberModel.java:175
> at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:123)
> at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:100)
> at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)

Probably you're right, but we upgraded FreeMarker because of some
security issues and we don't plan to revert it because of your
problem. So, you can stay with 2.3.1.2 and start migrate your
application.


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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


Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by st...@spamgourmet.com.
Chris,

Surrounding it with quotes would mean that I'd have to change all my UI templates, as well as my theme templates.   Note how my theme template expects a Boolean (not a String) attribute, below:

> < <#if parameters.required?default(false)>
> <  required="true"<#rt/>
> < </#if>


From my perspective this represents a regression from 2.3.1.2, where what I had previously worked fine.
It could be due to FreeMarker change, since I also have this in my log:

Caused by: freemarker.template.TemplateModelException: Argument type mismatch; can not unwrap argument #1 (class: freemarker.ext.beans.BooleanModel, toString: "true") to class java.lang.String
at freemarker.ext.beans.SimpleMemberModel.createArgumentTypeMismarchException(SimpleMemberModel.java:175
at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:123)
at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:100)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)



On May 25, 2012, at 1:58 PM, struts.rgm@spamgourmet.com wrote:

> After installing Struts 2.3.4, it appears that dynamic attributes must be strings now?
> 
> I've modified text.ftl in my custom theme like this (diff output):
> 23c23
> < <input type="${parameters.type?default("text")}"<#rt/>
> ---
> > <input type="text"<#rt/>
> 46,54d45
> < <#if parameters.required?default(false)>
> <  required="true"<#rt/>
> < </#if>
> < <#if parameters.autofocus?default(false)>
> <  autofocus="autofocus"<#rt/>
> < </#if>
> < <#if parameters.pattern?? >
> <  pattern="${parameters.pattern?html}"<#rt/>
> < </#if>
> 62c53
> < />
> 
> 
> So that I can use dynamic attributes / HTML5 goodness like this:
> 
> <@s.text type="email" key="user.email" required=true autofocus=true />
> 
> But now Struts 2.3.4 blows up with this message:
> 
> 
> Method public java.lang.String org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String) threw an exception when invoked on org.apache.struts2.util.StrutsUtil@540948a7
> The problematic instruction:
> ----------
> ==> assignment: value=struts.translateVariables(keyValue)!keyValue [on line 27, column 3 in /themes/simple/dynamic-attributes.ftl]
>  in include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on line 52, column 1 in /themes/simple/text.ftl]
>  in include "/${parameters.templateDir}/simple/text.ftl" [on line 25, column 1 in /themes/my-custom-theme/text.ftl]
> ----------
> 
> I made sure to update my simple theme, perhaps I missed some template files?  Can anyone help?


Re: pass action form

Posted by Joby Joseph <jo...@almullagroup.com>.
Hi,
it is in Struts 1.2 and I posted it in the group also...



----- Original Message ----- 
From: "Łukasz Lenart" <lu...@googlemail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, May 28, 2012 1:04 PM
Subject: Re: pass action form


2012/5/28 Joby Joseph <jo...@almullagroup.com>:
> I have a form asociated with a JSP. and am setting some values into the 
> form
> before loading the page and I am not showing it on the JSP. But I have to
> get the value in the Action class. scope of the form is request.
>
> that meanss, from JSP, have to send the form to action again. is there any
> method to do so?

Struts 2 or Struts 1 ?

And please direct your message to the group, not directly to me ;-)


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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





Disclaimer :

This e.mail message may contain confidential, proprietary or legally privileged information. It should not be used by anyone who is not the original intended recipient. If you have erroneously received this message, please delete it immediately and notify the sender. The recipient acknowledges that Al Mulla Group or its subsidiaries and associated companies*, are unable to exercise control or ensure or guarantee the integrity of / over the contents of the information contained in e.mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Al Mulla Group. Before opening any attachments please check them for viruses and defects.

* List of Companies covered under Al Mulla Group of Companies. 
1. Al Mulla Group Holding Co. K.S.C.C.
2. Bader Al Mulla & Brothers Co. W.L.L.
3. Saleh Jamal & Co. W.L.L.
4. Maseelah Trading Co. W.L.L.
5. Al Mulla Rental & Leasing of Vehicles & Equipment Co. K.S.C.C.
6. Al Mulla International Financing & Investment Co. K.S.C.C.
7. Al Mulla Cleaning & Maintenance Service Co. W.L.L.
8. Gulf Trading Group W.L.L.
9. Al Mulla Insurance, Reinsurance & Broking Co. W.L.L.
10. Al Mulla Consultancy Co. W.L.L.
11. Al Mulla Environmental Systems W.L.L
12. Al Mulla Real Estate 
13. Al Mulla Security Services Co. W.L.L.
14. Al Mulla International Exchange Co. K.S.C.C
15. Al Mulla & Behbehani Motor Co. W.L.L.
16. Al Mulla Building Construction Co. W.L.L.
17. Al Soor Financing & Leasing Co. K.S.C.C.
18. Larsen & Toubro Kuwait Construction & General Trading Co. W.L.L.
19. Kuwait Commercial Agency
20. Khadamat Marketing & Automotive Services Co.
21. Al Mulla General Trading for Safety, Security, & Fire Systems & Equipment Co. W.L.L.
22. Iraq International Import, Export & Commission Agent CO. W.L.L. (Iraq)
23. Al Mazayah Al Aulah General Trading Co. LLC (Dubai, UAE)
24. Al Mazayah Al Thania Car Trading LLC (Dubai, UAE)
25. AMG Steel & Systems Co. PVT LTD, (India)
26. Al Mulla Travel Bureau
27. Diamond International Motors Co. (Egypt)
28. Nasser Bin Khaled & Al Mulla Cars Rent Co. W.L.L. (SELECT RENTAL CAR), (Qatar)
29. Modern Exchange Co. (Oman)

#####################################################################################
Scanned by Brightmail
#####################################################################################


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


Re: pass action form

Posted by Łukasz Lenart <lu...@googlemail.com>.
2012/5/28 Joby Joseph <jo...@almullagroup.com>:
> I have a form asociated with a JSP. and am setting some values into the form
> before loading the page and I am not showing it on the JSP. But I have to
> get the value in the Action class. scope of the form is request.
>
> that meanss, from JSP, have to send the form to action again. is there any
> method to do so?

Struts 2 or Struts 1 ?

And please direct your message to the group, not directly to me ;-)


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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


Re: pass action form

Posted by Łukasz Lenart <lu...@googlemail.com>.
2012/5/28 Joby Joseph <jo...@almullagroup.com>:
> if u can, plz send me the code for this ... it will help me to complete the
> work.

You mean the patch to improve support of Dynamic Attributes ?


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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


pass action form

Posted by Joby Joseph <jo...@almullagroup.com>.
Hi Łukasz,

if u can, plz send me the code for this ... it will help me to complete the 
work.


Regards,

----- Original Message ----- 
From: "Łukasz Lenart" <lu...@googlemail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, May 28, 2012 12:02 PM
Subject: Re: Dynamic Attributes can't be boolean? 
StrutsUtil.translateVariables exception


2012/5/25  <st...@spamgourmet.com>:
> Method public java.lang.String 
> org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String) 
> threw an exception when invoked on 
> org.apache.struts2.util.StrutsUtil@540948a7
> The problematic instruction:

I've missed that out, need to check the code ...


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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





Disclaimer :

This e.mail message may contain confidential, proprietary or legally privileged information. It should not be used by anyone who is not the original intended recipient. If you have erroneously received this message, please delete it immediately and notify the sender. The recipient acknowledges that Al Mulla Group or its subsidiaries and associated companies*, are unable to exercise control or ensure or guarantee the integrity of / over the contents of the information contained in e.mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Al Mulla Group. Before opening any attachments please check them for viruses and defects.

* List of Companies covered under Al Mulla Group of Companies. 
1. Al Mulla Group Holding Co. K.S.C.C.
2. Bader Al Mulla & Brothers Co. W.L.L.
3. Saleh Jamal & Co. W.L.L.
4. Maseelah Trading Co. W.L.L.
5. Al Mulla Rental & Leasing of Vehicles & Equipment Co. K.S.C.C.
6. Al Mulla International Financing & Investment Co. K.S.C.C.
7. Al Mulla Cleaning & Maintenance Service Co. W.L.L.
8. Gulf Trading Group W.L.L.
9. Al Mulla Insurance, Reinsurance & Broking Co. W.L.L.
10. Al Mulla Consultancy Co. W.L.L.
11. Al Mulla Environmental Systems W.L.L
12. Al Mulla Real Estate 
13. Al Mulla Security Services Co. W.L.L.
14. Al Mulla International Exchange Co. K.S.C.C
15. Al Mulla & Behbehani Motor Co. W.L.L.
16. Al Mulla Building Construction Co. W.L.L.
17. Al Soor Financing & Leasing Co. K.S.C.C.
18. Larsen & Toubro Kuwait Construction & General Trading Co. W.L.L.
19. Kuwait Commercial Agency
20. Khadamat Marketing & Automotive Services Co.
21. Al Mulla General Trading for Safety, Security, & Fire Systems & Equipment Co. W.L.L.
22. Iraq International Import, Export & Commission Agent CO. W.L.L. (Iraq)
23. Al Mazayah Al Aulah General Trading Co. LLC (Dubai, UAE)
24. Al Mazayah Al Thania Car Trading LLC (Dubai, UAE)
25. AMG Steel & Systems Co. PVT LTD, (India)
26. Al Mulla Travel Bureau
27. Diamond International Motors Co. (Egypt)
28. Nasser Bin Khaled & Al Mulla Cars Rent Co. W.L.L. (SELECT RENTAL CAR), (Qatar)
29. Modern Exchange Co. (Oman)

#####################################################################################
Scanned by Brightmail
#####################################################################################


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


Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Łukasz Lenart <lu...@googlemail.com>.
Done, please check the latest snapshot

https://issues.apache.org/jira/browse/WW-3828

2012/5/28 Łukasz Lenart <lu...@googlemail.com>:
> 2012/5/28 Łukasz Lenart <lu...@googlemail.com>:
>> I've missed that out, need to check the code ...
>
> Ok, I was able to reproduce your problem and changed support for
> Dynamic Attributes in Struts to solve that. Please register an issue
> for that, but IMHO it's a bad idea to use strict literals, it's better
> to wrap them with quotas - at the end they're just strings ;-)
>
>
> Regards
> --
> Łukasz
> mobile +48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/

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


Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Łukasz Lenart <lu...@googlemail.com>.
2012/5/28 Łukasz Lenart <lu...@googlemail.com>:
> I've missed that out, need to check the code ...

Ok, I was able to reproduce your problem and changed support for
Dynamic Attributes in Struts to solve that. Please register an issue
for that, but IMHO it's a bad idea to use strict literals, it's better
to wrap them with quotas - at the end they're just strings ;-)


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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


Re: Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception

Posted by Łukasz Lenart <lu...@googlemail.com>.
2012/5/25  <st...@spamgourmet.com>:
> Method public java.lang.String org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String) threw an exception when invoked on org.apache.struts2.util.StrutsUtil@540948a7
> The problematic instruction:

I've missed that out, need to check the code ...


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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