From: "Rob Turknett" <[EMAIL PROTECTED]>
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 have the same requirements. I use a combination of a Filter to check
whether the user is logged in, and a Session Listener to retrieve the items
and put them in session scope. (Neither of these is dependent on Struts.)
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]