struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kibo <tomasjur...@gmail.com>
Subject Validate associate Map
Date Sat, 16 Aug 2008 10:05:00 GMT

Hi konference

How can I validate classes which are associated in collection.
The class "Page" contents Map with "PageText" classes:

Page.java
------------------
private Map<LanguageName, PageText> texts = new HashMap();

 ... getter / setter

PageText.java
--------------------------
private String description;

@StringLengthFieldValidator(message="Length too short",
key="validate.minLength.6", trim=true, mimLength = "6")
    public void setDescription(String description) {
        this.description = description;
    }

Action.java
-------------------
private Page page; 

//it work but I need validate all classes in Map, not only ['en']
 @Validations( visitorFields = {
        @VisitorFieldValidator(
                message = "Default message", key = "i18n.key",
                fieldName= "page.texts['en']", appendPrefix = false) } 
    )
    public String execute() throws Exception{                                            

        return Action.SUCCESS;
    }

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

When I set: fieldName= "page.texts['en']" it work, but in Map are a lots of
classes.
I need validate all class in collection.
When I set only: fieldName= "page.texts" it dont work.
I need set something of : fieldName= "page.texts[*]" but it dont work.

How can I determine in attribute fieldName as to validate all classes in
"page.texts" ?
Is it possible or I must resolve it otherwise?

Thanks a lot


-----
Tomas Jurman
Czech Republic
-- 
View this message in context: http://www.nabble.com/Validate-associate-Map-tp19010237p19010237.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message