Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-26 Thread Célio Cidral Junior
Hi Chris, 2007/1/25, Christopher Schultz <[EMAIL PROTECTED]>: I agree with Dave: you're trying to do too much in your forms. I disagree. There are two options that I consider acceptable for me. One of them is to write getters and setters for each form's field (just like a form bean). The other

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Célio, Célio Cidral Junior wrote: > The problem happens when the user > is *altering* an existing customer (creating a new customer works > fine), more specifically when the user is submitting changes from the > form to an existing customer object (al

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider
I think your best bet would be to break up the parameter setting into 2 parts. (A variation on the paramsPrepareParamsStack) The first part would set all parameters needed to load the data from the data. Then in the prepare, you would have the id's needed to load the data from the database. The

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dale Newfield
Célio Cidral Junior wrote: Well, having Struts passing parameters in the order defined by the html form would solve my problem. :-) While setting parameters in a request struts has no idea what order they were ordered in the originally generated form--remember that a single action may be cal

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior
2007/1/25, Tom Schneider <[EMAIL PROTECTED]>: Unfortunately I don't think that's possible. The parameters get put into a map structure, so the original parameter order is lost by the time it gets to the servlet API. We've run into several instances where something will work on one app server, b

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider
Unfortunately I don't think that's possible. The parameters get put into a map structure, so the original parameter order is lost by the time it gets to the servlet API. We've run into several instances where something will work on one app server, but break on another because we had duplicate pa

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior
2007/1/25, Tom Schneider <[EMAIL PROTECTED]>: This is an issue with the typical edit/save scenario. The problem we are discussing is that the domain model is needed in some form before the parameter can be repopulated from the form save. The technique you are using is to reread the data from th

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider
This is an issue with the typical edit/save scenario. The problem we are discussing is that the domain model is needed in some form before the parameter can be repopulated from the form save. The technique you are using is to reread the data from the database before the parameters are set. An a

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior
2007/1/25, Dale Newfield <[EMAIL PROTECTED]>: Célio Cidral Junior wrote: > Implementing Preparable does not seem to solve the problem because the > parameters are set before the prepare() method is invoked. Which is needed in order to know which object to retrieve from the DB. I think you have

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dale Newfield
Célio Cidral Junior wrote: Implementing Preparable does not seem to solve the problem because the parameters are set before the prepare() method is invoked. Which is needed in order to know which object to retrieve from the DB. This model usually includes including the parameters interceptor tw

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior
2007/1/25, Dave Newton <[EMAIL PROTECTED]>: 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.

RE: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dave Newton
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 writi