This is what I think about the listener approach. In our project even though we use HttpSessionAttributeListener, we are loading only the login user profile as a java bean. We don't mix servlet listeners and Struts forms. We could load data into POJO's and then copy it into ActionForms whenever they are needed. I am not sure about the efficiency of this approach for large number of forms.
The filter is hit even before the ActionServlet is hit the VERY first time. So Struts is not even loaded unless you use the load on startup tag. Again here we load our own javabeans. But when we need to prepopulate we set up our ActionForms Just-in-Time. Our data that don't change often is in javabeans loaded by our ServletContextListener. Mohan -----Original Message----- From: Curtney Jacobs [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 9:33 AM To: Struts Users Mailing List Subject: Calling a default Action upon App startup Greetings everyone! I would like to preopulate serveral forms with default values retrieve from a database upon application startup or after a successful login by the user. I have an approach in mind, however, I am not sure if it is the most efficient or best approach. My approach is to use a filter that creates and stores in memory default ActionForms. The ActionForm will contain default values for select fields (or any other fields) retrieved from a database. The ActionForms will be stored within the current user session and then controll will be given over to Struts ActionServlet. Another similar approach would be to register a listerner (HttpSessionAttributeListener) that would essentially wait for a specific attribute to be added into the session (i.e SETUP_FORMS) then it would query the database for neccessary application setup data. I read the message archive, and a few have suggested calling a "setup action" per request that prepopulates the default values in the ActionForm. This is a valid approach, but IMHO only for small applications. It just seems that there will be to much "traffic" going on between the app and the database. Correct me if I am wrong. If you have gotten this far please share your thoughts on this topic. Curtney --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]