Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 26 May 2012 04:10:14 -0000 Issue 9607

user-digest-help

2012-05-26


Author LoginPost Reply

user Digest 26 May 2012 04:10:14 -0000 Issue 9607

Topics (messages 212862 through 212867)

Re: conversion error repopulation not working
 212862 by: Łukasz Lenart
 212863 by: J. Garcia

[ANN] Struts 2.3.4 GA release available
 212864 by: Łukasz Lenart

Dynamic Attributes can't be boolean? StrutsUtil.translateVariables exception
 212865 by: struts.rgm.spamgourmet.com
 212866 by: Chris Pratt
 212867 by: struts.rgm.spamgourmet.com

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_212862.eml (zipped)
Could you add some code example ?


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


Attachment: user_212863.eml (zipped)
Thanks Lukasz for your reply.

While preparing a minimal example, I got the reason of it all.

The real situation is:
- The input form has an int field
- The value already available should be formatted and localized: 43,000 /
43.000
- In order to achive l10n, the input field tag is like this:

  <s:textfield key="mybean.value" required="false"
value='%{getText("number.format",{mybean.value})}'/>

In such a situation, the TextProviderHelper.getText() method is run, which
obtains the value from the bean, rather than obtaining it from the wrong
user input which was not possible to convert into the bean.

It would be nice if there was a specific method which would check if the
value to obtain is from an input field with conversion error. In such a
case, it would obtain the value from the user input. If no error, the value
would be from the bean.

Does it make sense?

Cheers,
J.


On Thu, May 24, 2012 at 8:10 AM, Łukasz Lenart <lukasz.lenart@(protected)
> wrote:

> Could you add some code example ?
>
>
> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_212864.eml (zipped)
The Apache Struts group is pleased to announce that Struts 2.3.4 is
available as a "General Availability" release. The GA designation is
our highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

All developers are strongly advised to update existing Struts 2
applications to Struts 2.3.4.

Struts 2.3.4 is available in a full distribution, or as separate
library, source, example and documentation distributions, from the
releases page.
* http://struts.apache.org/download.cgi#struts234

The release is also available from the central Maven repository under
Group ID "org.apache.struts".

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions:
* Java Servlet 2.4 and JavaServer Pages (JSP) 2.0
* Java 2 Standard Platform Edition (J2SE) 5

The release notes are available online at:
* http://struts.apache.org/2.x/docs/version-notes-234.html

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.appropriate, file a tracking
ticket:
* https://issues.apache.org/jira/browse/WW


- The Apache Struts group.

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


Attachment: user_212865.eml (zipped)
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:

<@(protected) />

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@(protected)
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?

Attachment: user_212866.eml (zipped)
Try surrounding the attributes in quotes (e.g. "true" instead of true).
(*Chris*)

On Fri, May 25, 2012 at 11:58 AM, <struts.rgm@(protected):

> 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:
>
> <@(protected) />
>
> 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@(protected)
> 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?

Attachment: user_212867.eml (zipped)
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@(protected):

> 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:
>
> <@(protected) />
>
> 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@(protected)
> 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?

©2008 gg3721.com - Jax Systems, LLC, U.S.A.