You should not access the JSP directly. Always send requests to the Action which will return an ActionForward to the JSP. In your example you should always be accessing /myaction.do and never /MyLayer.jsp
You seem to have it set up OK, but there's no need for your global forward to the JSP. Steve > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: June 24, 2003 3:22 AM > To: [EMAIL PROTECTED] > Subject: Best practices - help > > > 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> > ---- > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

