I think it's right only in simple cases
If your prepare means:
- Putting in the request a collection for a select (for example)
- Initializing the form with data from DB or any other source
You are doing 2 things completely different (logically)
in the same action and that's why you need a
Ok. So an action prepares the collection for the select.
The other one initializes the form with data from DB.
To which one should I set the input property of the save action?
If I set it to the second one (which initializes the form) I will
have the same problem... should this action
The input for the save action is the second action or the jsp
page if you use a filter.
Am i missing something?
No! Yu're right! Why didn't I think about it!?
THANK YOU
(grazie...)
-
To unsubscribe, e-mail: [EMAIL
in other words, your setup action will be called only when you enter
the page for the first time
Suppose I have:
1) A listbox with values retrieved from db
2) a form with values retrieved from db that the user can change.
Now, if I don't call the setup action when there's a validation error,
I'm sorry, I'll try to explain better.
If I used your solution in case of a validation error my list box
would not be filled.
When you have a validation error it returns to the page where you
filled the
list box and these values are the same that the user introduced.
The listbox and
When an error occur, it doesnt return to preprare action. It just back to
the page selected in the tag input (input=/prepare.jsp )
You dont need to write code like this...
if (!comingFromAValidationError())
form.fillfromDB();
else
// leave form as is, with data entered by the user
}
Ok,
I understand you...
Let me I think it...
I found 2 solutions so far:
1) hidden field in the form
(extending a Form that has an hidden field and extending an action that has
a method
like isComingFromAValidatorError() that looks for the value of the hidden
par)
2) If the request is a GET
It seems a good solution, but compared to the hidden field:
1) I have to set up an action just to show the error. With
the hidden field I could use 2 action (instead of 3)
doing something like
if (hiddenpar.isSet()) {
leave form as is, we are here because validation failed
} else {
I don't think I made myself clear.
I can't set the input of the process action to the jsp of the prepare
action because in the prepare action I get data from the db to
fill a listbox.
If I used your solution in case of a validation error my list box
would not be filled.
But if I set the input
The values that you read from the DB need to come from somewhere.
Perhaps you can store them in a session attribute (then clear it once the
form passes validation). Oh, yeah, an action has to prepare them, so maybe
you can use the same action, except that before it reads from the DB, it
checks if
10 matches
Mail list logo