• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Validator on map-backed Form properties?  RSS feed

P-A Rosenberg
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to achive Javascript based form validation using the Struts validator framework on a Form containing a Map.

I think I know how to validate this "server side" but is it possible to use the Validator framework for the purpose and generate a javascript popup?

Copy/paste from Form:
public class OrderResourceModifyForm extends ValidatorForm
private Map timeTypePrices;
public OrderResourceModifyForm()
this.timeTypePrices = new HashMap();

public void setTimeTypePrice(String key, Object value)
this.timeTypePrices.put(key, value);

public Object getTimeTypePrice(String key)
return this.timeTypePrices.get(key);

Copy/paste from JSP:
<c:forEach var="orderResourcePrice" items="${timeTypePriceList}">
<html-el:text property="timeTypePrice(${orderResourcePrice.timetype.id})" value="${orderResourcePrice.pricePerHour}" />

Please help me write the field entry in my validation.xml in order to validate the input stored in the map timeTypePrices!
The attempt below doesn't do the trick...

<form name="OrderResourceModifyForm">

depends="required, float" >
<arg0 key="label.orderresource_add_edit.price_per_hour"/>


Any help is appreciated!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!