struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: Tiles Controller in definitions
Date Wed, 26 Mar 2003 04:54:16 GMT
Well there's only 1 method in the Controller interface:
http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html

What happens when you do a System.out... in the controller?

David



>From: "Kevin Cramer" <kcramer@siscom.net>
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: struts-user@jakarta.apache.org
>Subject: Tiles Controller in definitions
>Date: Tue, 25 Mar 2003 21:50:19 -0500
>
>
>I'm trying to setup a controller for a Tiles definition.  I follow the
>examples I've seen but it appears that the controller class is not
>called.  I've seen posts here that indicate that you need to use
>tiles:insert to enable the controller but I'm always using that
>whenever I include the JSP.  Perhaps my use of tile definitions is
>causing problems?  I'm also unsure whether I'm supposed to use the
>perform() or execute() on the Controller interface.  The error I get
>is that the JSP of the tile with the controller complains that it
>cannot find the object that I am doing the putAttribute with.  The
>error is on the tiles:importAttribute.
>
>I have the following in my tiles-defs.xml:
>
><definition name="standardPage"
>             path="/WEB-INF/common/layouts/standardLayout.jsp">
>     <put name="title.key"   value="title.notDefined" />
>     <put name="header"      value=".standardPage.header" />
>     <put name="content"     value="NO CONTENT DEFINED" />
>     <put name="left"        value="/WEB-INF/common/other1.jsp" />
>     <put name="right"       value="standardPage.testcontroller" />
></definition>
>
><definition name=".standardPage.header"
>             path="/WEB-INF/common/header.jsp">
>     <put name="headerbar"  value="standardPage.header.bar"/>
></definition>
>
><definition name="standardPage.header.bar"
>             path="/WEB-INF/common/bar.jsp">
>     <put name="left"  value="NO LEFT DEFINED" />
>     <put name="right" value="NO RIGHT DEFINED" />
></definition>
>
>
><definition name="standardPage.testcontroller"
>             path="/WEB-INF/common/testcontroller.jsp"
>             controllerClass="mytest.TestAction">
></definition>
>
>Here is the testcontroller.jsp:
>
><%@ taglib uri="/tags/struts-html" prefix="html" %>
><%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
>
><tiles:importAttribute name="TEST"/>
><bean:write name="TEST" property="value"/>
>
>
>Here is the controller class:
>
>public final class TestAction extends TilesAction implements Controller {
>         public static final String TEST_KEY = "TEST";
>
>         public ActionForward perform(
>                 ComponentContext context,
>                 ActionMapping arg1,
>                 ActionForm arg2,
>                 HttpServletRequest arg3,
>                 HttpServletResponse arg4)
>                 throws IOException, ServletException {
>
>                 perform(context, arg3, arg4, 
>getServlet().getServletContext());
>                 return null;
>         }
>
>         public void perform(
>                 ComponentContext context,
>                 HttpServletRequest arg1,
>                 HttpServletResponse arg2,
>                 ServletContext arg3)
>                 throws ServletException, IOException {
>
>                 MyTestObject test = new MyTestObject("Test Value");
>                 context.putAttribute(TEST_KEY, test);
>         }
>
>         public ActionForward execute(
>                 ComponentContext context,
>                 ActionMapping arg1,
>                 ActionForm arg2,
>                 HttpServletRequest arg3,
>                 HttpServletResponse arg4)
>                 throws Exception {
>
>                 perform(context, arg3, arg4, 
>getServlet().getServletContext());
>                 return null;
>         }
>}
>
>
>Thanks,
>Kevin
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message