struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Newton" <>
Subject RE: Make Struts set form data onto the action in same order as the form's fields
Date Thu, 25 Jan 2007 17:38:53 GMT
From: CĂ©lio Cidral Junior
> 	public Customer getCustomer() {
> 		if (customer == null)
> 			customer = id != 0 ? dao.get(id) : new Customer();
> 		return customer;
> 	}
> [...]
> The way I built both the action and the view prevents me from writing
> a lot of extra code (like getters and setters for each of the form's
> field), and that's why I would like to know whether there's a way to
> make Struts follow the fields' ordering when submitting the data into
> the action. And if there's not, may the Struts dev team implement
> that, if possible.

That seems extremely unlikely, but they may have a different take on it. 

>From my point of view it seems like your implementation is broken: if you need to create
a Customer from an ID passed via a form or URL then you either need to implement Preparable
or do the DAO operations in the (in your case) input or save methods.

IMO that functionality does *not* belong in a getter.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message