Hi all,

I've been reading through a lot of the Struts info available on
the web in various places, and I have a question I'm hoping
one of you more experienced folks can answer.  There is
something simple that I think I'm still not getting.

How, using the tag libraries of Struts, can I do the following:

1. If this is the first time that a user has visited the page, then
    the form isn't pre-populated with any values.  The user just
    types in his/her desired form field values and hits submit.

2. If the webapp knows what the values should be, then the
    form is first pre-populated with data for the user to edit
   (e.g. if the user was on that page before but validation 
    failed, so all the fields are pre-populated with the user's
    previously-submitted data).

I think that somehow the html:form and/or bean:parameter
tags are where I need to look.  To make this more concrete,
think of your standard login page.  When the user first hits
the app, they type in their username and password on some
login.jsp page.  If they screw up their password, they'll get
sent back to the login.jsp page, but now to be nice we'll
have the username field pre-populated.  That was a simple
example; extend it to complex forms where there is a lot
of data to keep track of and multiple paths back to the form.  

In other words, what I'm looking for is the best (or at least
typical) idiom for using the struts tag libraries and associated
classes to capture the user data and bundle it not only for 
processing by its action but to also hand that bundle back 
to a JSP page if necessary.

 If somebody could show me a simple example of what the
JSP page and appropriate fragments of some associated form 
and action class, I'd be muchly appreciative.  I'd probably also 
begin to feel a little more clueful than I do at the moment...

Thanks!

        Reid

 



---------------------------------
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctionsfor all of your holiday gifts!

Reply via email to