[ http://mc4j.org/jira/browse/STS-351?page=all ]

Tim Fennell resolved STS-351.
-----------------------------

    Fix Version/s: Release 1.4.3
       Resolution: Fixed

This turned out to be a simple fix.  A regex is used to identify bracketed 
groups (e.g. [123]) and remove them from the property name.  But a greedy 
quantifier was used so it matched that first opening and last closing bracket.  
Changing to a reluctant quantifier fixed it right up.

> Wrong key used to lookup field name in foo[1].bar[2].baz
> --------------------------------------------------------
>
>                 Key: STS-351
>                 URL: http://mc4j.org/jira/browse/STS-351
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.4.2
>            Reporter: Andy
>         Assigned To: Tim Fennell
>             Fix For: Release 1.4.3
>
>
> The field name for field "foo[1].bar[2].baz" should be obtained from key 
> "foo.bar.baz" in StripesResources.properties. Currently, it is obtained from 
> key "foo.baz".
> In the following test case, entering "x" on the text field generates
> Please fix the following errors:
>    1. The value (x) entered in field Wrong must be a valid number
> The expected message is "... in field Correct ..."
> ==> BarType.java <==
> package com.myco.action;
> public class BarType {
>     private Integer baz;
>     public Integer getBaz() { return baz; }
>     public void setBaz(Integer baz) { this.baz = baz; }
> }
> ==> FooType.java <==
> package com.myco.action;
> import java.util.*;
> public class FooType {
>     private Map<String, BarType> bar = new HashMap<String, BarType>();
>     public Map<String, BarType> getBar() { return bar; }
>     public void setBar(Map<String, BarType> bar) { this.bar = bar; }
> }
> ==> TestAction.java <==
> package com.myco.action;
> import java.util.*;
> import net.sourceforge.stripes.action.*;
> public class TestAction implements ActionBean {
>     private ActionBeanContext context;
>     public ActionBeanContext getContext() { return context; }
>     public void setContext(ActionBeanContext context) {
>         this.context = context;
>     }
>     private Map<String, FooType> foo = new HashMap<String, FooType>();
>     public Map<String, FooType> getFoo() { return foo; }
>     public void setFoo(Map<String, FooType> foo) { this.foo = foo; }
>     public Resolution nothing() {
>         return getContext().getSourcePageResolution();
>     }
> }
> ==> StripesResources.properties <== (add these)
> foo.baz=Wrong
> foo.bar.baz=Correct
> ==> index.jsp <==
> <%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"; 
> %>
> <stripes:form beanclass="com.myco.action.TestAction">
>     <stripes:errors/>
>     <stripes:text name="foo[1].bar[2].baz"/>
>     <stripes:submit name="nothing"/>
> </stripes:form>
> ==> (end) <==

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to