Prepopulating a form with Struts


General J2EE: Prepopulating a form with Struts

  1. Prepopulating a form with Struts (1 messages)

    Hi, I´m just begining using Struts and have a really simple question: how can I prepopulate a form using Struts? Here is my situation: I just wrote a simple program (with Struts) that write some data in the database using the data stored on the form (ActionForm). Now I want to edit this data. How can I get this data and store it back again on a form using Struts?
  2. Hi Henrique Your action is run before your jsp. You can populate your form bean in your action. Let your action do the talking with your backend and retrieve the data to put in your form. If you use Struts tags in your jsp, the data will appear in your input fields. BTW you can reuse a form bean in several actions. And if the actions scope is session, it will be the same bean in all actions. Hope it can help U out.. :o) Thomas