wood burning stoves
The moose likes Struts and the fly likes Struts Validator on map-backed Form properties? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator on map-backed Form properties?" Watch "Struts Validator on map-backed Form properties?" New topic

Struts Validator on map-backed Form properties?

P-A Rosenberg

Joined: Sep 22, 2005
Posts: 15

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!
I agree. Here's the link: http://aspose.com/file-tools
subject: Struts Validator on map-backed Form properties?
jQuery in Action, 3rd edition