Guojun Zhu wrote:
Hi,
I am new to struts. I am using Struts 1.2.9. I have two String arrays
generated in an action should go to the JSP pages <html:options>. I can set
it as an attribute in request/session and pull them in jsp pages. But it
seems a bit against the idea of separation between model and view. If I
change the view from JSP then there might be some difficulty to pull the
object out. Is there any other ways to do this? What will be the best
practice for a thing like this? Thanks.
Placing data into request or session scope is the standard way to expose
it for display in Struts1. Any view templating technology you may choose
(JSP, Velocity, etc.) should allow access to request and session scoped
attributes, so that shouldn't be a concern.
However, since you mention html:options, I guess this is data you want
to both display and edit/update. In that case, as suggested in the other
reply, using the ActionForm mechanism is the right way go.
Some people like to use ActionForm beans regardless of whether the data
is for ouput only or input/output, to be consistent in how the view and
action communicate, but that's a matter of choice.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]