Is there a way to populate a bean  on a Server's (I'm using Tomcat) start up 
in Struts?

I have a Java bean, say X, which is called and a populated in an Action 
Servlet, say myAction. Whenever I start my application and call a JSP layer say, 
MyLayer.jsp,  which is supposed to iterate this bean using <logic:iterate>, 

I get the exception: 
org.apache.jasper.JasperException: Cannot find bean X in scope session
-----
-----

However, this exception disappears when I first call the Action Servlet 
directly with a call such as http://localhost/myaction.do , followed by a 
http://localhost/MyLayer.jsp call.

Apparently the bean has nothing to show when I first call MyLayer.jsp.

Can someone suggest a better approach?

Thanks

Bob

Ps.: the bean, X, get its values from a database. 

my struts-config.xml snippet :

---
--

      <global-forwards>
        <forward name="books" path="/MyLayer.jsp"/>
         -------
         -------
    </global-forwards>
    <action-mappings>
        <action path="/myaction"
            type="com.myController.myAction"

            scope="session"
            >
            <forward name="books" path="/MyLayer.jsp"/>
        </action>

    </action-mappings>
----

Reply via email to