sriram wrote:
James,

As explained by you, I have done the following:

I need list of countries in a drop-down box in .jsp page.

I have an EJB that maps to country table in database.
In that I've a method getAllCountries() that returns a collection.
In that method, I've used LabelValueBean and storing labels and values in the 
collection.

I'm using a Session Fa�ade, so this method is called by a session bean which obtains the collection of countries.

Now I would like to know the next step - creating a "pre" action which obtains this 
collection and stores it in 'request'.
I've an action form with getter and setter methods for 'countryID' (countryID is the name of my 
<html:select> in the jsp page). But how to create a "pre" action? Can you pl. explain

Create a Filter and map it to any resources that will need the countries collection. (I think you need to map it to the resource that will be requested, not the JSP that is forwarded-to -- so, in other words, map it to the Actions that will need it.)


In this Filter you can make the call to the session facade that gets the list of countries, and then you can store it into the Request as an attribute. Later, your Action or JSP can extract this information from the Request to build the drop-down. If you run into performance problems, you might want to cache this action either in the Session Facade itself, or in an application-scoped attribute stored in the ServletContext. But I'm not sure how often your country list might change.


Erik



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to