Michael Jouravlev wrote:
You do realize, that JSP _is_ a part of app source code, do you? And

Err, well, yes... ;-)

the more you put into JSP, the more this supposedly dumb JSP page will
look like "real code"? If you ship without source code, you'd rather
precompile the JSPs.

That would make the task of customizing the application somewhat harder! :-) The point is that the customer can edit the JSPs but I don't want them to have to edit and recompile action classes in order to achieve the customizations they need. So yes, they get some 'source code' (the JSPs) but not the rest.

I should also perhaps clarify that I do use the normal action proceessing model for handling inputs; the pull model is used mainly for simple view operations. The problem at hand is how to translate between the view objects used for exposing data to the JSP and the form beans used when submitting it for update.

The view object can't be used for storing form inputs if validation fails, since they are typed data structures. Hence, on first load, the page obtains a view to display; on subsequent re-loads due to validation failing, it needs to use the form bean instead of the view object. Once the form is submitted successfully, I handle transfering the content of the form bean into the view and, from there, to the domain model all server-side. No problem there.

L.


Now, to your problem. I will try to think right while I am typing.
First of all, I haven't actually used dynaforms, so no advices here.
Now, you want your input to go to action form? Why? Apparently,
because you want Struts to parse request data, and to perform
automatic validation. OK. So you need to associate form bean with
every incoming request, but you do not want to redefine form beans,
hence dynaform.

Struts uses getters and setters to put values into the form (at least
if it is not a dynamic form), so you can use getters and setters to
direct where the data goes... I am not sure how do you do this with
dynabean, but with regular bean you would have your getter pulling
data from your view object, and the setter storing data in the form
field. Then, after validation, you would type-convert and copy values
from form fields to your view object.

Or... you can still pull data from your view object and display values
using bean:write. But the tags themselves will have "property"
pointing to the form bean. I am not sure how this will work, but if
you were able to print values from view object, and submit them to the
form bean, then you'd just copy them to view object, and _then_
validate them. Then, if needed, you would redisplay data again from
the view object, which contains updated data (possibly incorrect, but
who cares, this view object is a _copy_ of a real object anyway,
right?). In this case you do not need getters in the form bean.
Because there are no getters, this "pull from view object, submit to
action form" might work. I have not really tried it.

Michael.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to