Rob Turknett wrote:
I want to populate a select element with items from a database. The items
can be retrieved by making calls to an API that retrieves data from the
database. These API methods may throw exceptions if the database is
inaccessible, or if the user is not logged in. The items only need to be
retrieved once per session, and should therefore be cached in the user's
session.
What is the best way to do this in Struts? Where should I make the calls to
retrieve the list items? If I do this in the ActionForm, I am not sure what
to do if an exception is thrown (for instance, if the user is not logged in,
how to forward to the login page).
I've looked around for information about how to do this, but haven't found
much. Any help or pointers to resources would be greatly appreciated.
You want to do it in the Action instead of the ActionForm. You can
catch/handle any exceptions you want to and forward as appropriate, or
let the exception propogate and use declarative exception handling to
serve the appropriate page.
HTH,
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]