Storing an attribute in application scope with Struts?
Posted on 2004-04-14
I'm trying to store an Enumeration in a Struts action such that its repeatedly available to a JSP (in order to reduce db access).
However, the Enumeration only appears to be available the first time the jsp is loaded. Subsequent use of the jsp results in a drop-down list with no entries.
Here is the code I'm using:
(In the action)
Enumeration estaff = staff.elements();
(In the jsp)
Enumeration estaff = (Enumeration) getServletContext().getAttribute("estaff");
<html:form action="signin.do" focus="username">
<html:options collection="estaff" labelProperty="staffName"
Can you tell me why this is happening and how I can resolve it.