Hi, I need to implement an "edit user" action in my web application.
This action will modify some data of selected user. To do this, I'm
using an ActionForm bean with editable properties.
I need the form on the web page to be populated with the data of
selected user. For example, if I'm editing "John Smith" I need that in
"Name" textbox there is "John" and in "Surname" one there is "Smith".
I think I have to initialize the form bean with the correct values,
but with reset() method I can only set default values and it doesn't
accept request object.
How can I do this?
david.karr - 07 Jun 2007 19:26 GMT
> Hi, I need to implement an "edit user" action in my web application.
> This action will modify some data of selected user. To do this, I'm
[quoted text clipped - 6 lines]
> accept request object.
> How can I do this?
This isn't the best place to ask a question like this. Going to the
"struts-user" mailing list is a better bet.
However, I'll give this a try, even though it's been quite a while
since I've worked on a Struts app.
Typically, logic like this should not go into the ActionForm. The
ActionForm is intended to be a dumb container without business logic.
It's more appropriate to do this in an Action method. Define
something like a "prepare" step for the "edit user" action which
creates an ActionForm and populates it with the appropriate data
before forwarding to the edit user page.
loris_p - 07 Jun 2007 22:20 GMT
Thanks a lot :)
Now I'll try to do in that way.
Thanks also for telling me about that group.