The action DoFirst.java isn't putting the userList bean into the request.
It should be doing something like
request.setAttribute("userList", userListBean);
It is also using the 'perform()' method, if you are using the latest struts then you should be using the 'execute()' method instead.
-- Jason Lea
Mykola Ostapchuk wrote:
Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class.
It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do
tiles-defs.xml:
<definition name="usersPage" path="/layout.jsp"> <put name="header" value="/header.jsp" /> <put name="footer" value="/footer.jsp" /> <put name="body" value="/users.jsp" /> </definition>
layout.jsp:
<[EMAIL PROTECTED] contentType="text/html"%> <html:html locale="true"> <html:base/> <body> <tiles:insert attribute="header" /> <tiles:insert attribute="body"/> <tiles:insert attribute="footer" /> </body> </html:html>
struts-config.xml:
<action path="/usersAdm" type="com.name.wos.struts.common.DoFirst"> <forward name="success" path="usersPage"/> </action>
DoFirst.java:
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;
public class DoFirst extends Action {
public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward("success"); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]