On Thu, 15 Mar 2001, Richard Yumul wrote:
> What's the process to dynamically populate a form? For example, say I click
> on a link w/ a URL something like:
>
> user.jsp?userid=34
>
> How would I code the user.jsp (and/or the accompanying classes) to fill in
> the form in user.jsp with user# 34's data in a struts-centric way?
>
> (If there's documentation somewhere on how to do this, please let me know,
> thanks)
>
The Struts example application does exactly this sort of trick.
On the registration.jsp page, do a View Source and look at the links in
the table of subscriptions down at the bottom -- specifically the edit
links. You will see that they link back to an action
(/editSubscription.do) rather than directly to a page. Which subscription
is being referenced is passed as query parameters.
The /editSubscription action looks up the existing subscription,
prepopulates the ActionForm bean, and forwards to the subscription.jsp
page for display. When you submit the updated subscription, it goes to a
different action (/saveSubscription) to be stored in the database.
> Thanks,
> Rich
>
Craig McClanahan