[ 
http://www.stripesframework.org/jira/browse/STS-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11694#action_11694
 ] 

Ľudovít Lučenič commented on STS-675:
-------------------------------------

Sorry, I accidentaly submitted the issue.

So, the description is the following:
In an ActionBean (bound on a jsp page) I need to use these useless proxy 
methods: 

        @Validate(required=true, on={"create","update"})
        public String getTitle() { return getEntity().getTitle(); }
        public void setTitle(String title) { getEntity().setTitle(title); }

in order to get the validation working on the entity title. Other validations 
on entity's nested attributes is working fine then:

        @ValidateNestedProperties({
                @Validate(field="visibility", required=true, 
on={"create","update"}),
                @Validate(field="rubric", required=true, 
on={"create","update"}),
                @Validate(expression="startDate == null || endDate == null || 
startDate < endDate"),
                @Validate(field="text", 
maxlength=Constants.MAX_SOUVENIR_TEXT_LENGTH, on={"create","update"})
        })
        public Contribution getEntity() {
                return super.getEntity();
        }

I guess the following code should be working instead of all previous:

        @ValidateNestedProperties({
                @Validate(field="visibility", required=true, 
on={"create","update"}),
                @Validate(field="title", required=true, on={"create","update"}),
                @Validate(field="rubric", required=true, 
on={"create","update"}),
                @Validate(expression="startDate == null || endDate == null || 
startDate < endDate"),
                @Validate(field="text", 
maxlength=Constants.MAX_SOUVENIR_TEXT_LENGTH, on={"create","update"})
        })
        public Contribution getEntity() {
                return super.getEntity();
        }

Could you please confirm my assumption ?

Besides I've once come across one very strange behaviour when there was 
important where are the validations placed within the action bean class code. 
It was something like when the validation method (or nested validation ?? I am 
not sure therefore I do not open another issue) was declared at the end of the 
class, the validation was never done by the Stripes framework. After I have 
moved this declared method (or getter with nested validations) to the beginning 
of the class, everything was working as expected. I guess this may  be related 
together with the abovementioned issue.

The validation works sometimes very strange for me.

> Validation of nested attributes is skipped
> ------------------------------------------
>
>                 Key: STS-675
>                 URL: http://www.stripesframework.org/jira/browse/STS-675
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.5, Release 1.5.1
>         Environment: Java 1.6, Tomcat 5.5, Apache 2
> application architecture uses Stripes as front-end for Hibernate that 
> connects to MySQL
>            Reporter: Ľudovít Lučenič
>
> In an ActionBean I need to use these useless proxy methods:

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

       

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to