Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Validate associate Map

Kibo

2008-08-16

Replies: Find Java Web Hosting

Author LoginPost Reply

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
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

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