Re: struts form population from an object model...

Discussion in 'Java' started by Sudsy, Jul 3, 2003.

  1. Sudsy

    Sudsy Guest

    flangelli wrote:
    <snip>
    > I have a business object model with attributes throughout that are
    > mapped to different form beans. Every time that a form bean (jsp) is
    > returned to the user's browser, I need to have a place to access my
    > object model to retrieve the data from and populate the bean before it
    > is displayed. So far it seems that the only time an action class is
    > given "command" is AFTER the form submission, I need control on a page
    > by page basis to retrieve the values from the object model into the
    > bean so the jsp can render the beans values.....anyone had a problem
    > similar to this? Thanks in advance - Flangelli


    There's nothing which "requires" you to forward to a JSP; you could
    just as easily forward to an action. The hitch here is that the
    ActionForm will be populated according to the request parameters if
    you just perform a forward. The solution is simply to specify
    redirect="true" in the forwarding action so that the request
    parameters get lost.
    Just be careful in your validate method when using this mechanism:
    you're users will be irked if the first time they see a page it
    contains all manner of error messages. Since you often provide a
    reset button on a form, the smart way to approach the situation is
    to hold off generating errors if all form fields are blank (or
    have the default value).
    If this doesn't make perfect sense then repost and I'll dig up
    some sample code. Or contact me off-line.
     
    Sudsy, Jul 3, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pratap Das
    Replies:
    2
    Views:
    2,041
    Pratap Das
    Apr 5, 2004
  2. Robert M. Gary

    html form population

    Robert M. Gary, Jan 31, 2006, in forum: Java
    Replies:
    2
    Views:
    4,045
    Robert M. Gary
    Feb 1, 2006
  3. Eric O. Angell

    optparse object population

    Eric O. Angell, Aug 5, 2004, in forum: Python
    Replies:
    1
    Views:
    286
    Peter Otten
    Aug 5, 2004
  4. sam
    Replies:
    1
    Views:
    213
    Steven D'Aprano
    Nov 5, 2006
  5. vindictive27
    Replies:
    1
    Views:
    138
    vindictive27
    Dec 17, 2007
Loading...

Share This Page