Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Editing data with Struts and ActionForm

Thread view: 
loris_p - 07 Jun 2007 15:55 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
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.