struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Cramer" <kcra...@siscom.net>
Subject Re: Tiles Controller in definitions
Date Wed, 26 Mar 2003 21:38:22 GMT

I was playing around with this more and if I include the tile with the
controller directly in the JSP with the <tiles:insert definition="">
tag then it works.  If I use the <tiles:insert name=""> tag which
refers to an attribute which dynamically defines the definition / JSP
to use then it does not work.

Can this not be done?  I would prefer to do it the way I am doing
since the tile that is inserted there is specified in a parent tile.

Thanks,
Kevin

On Wed, Mar 26, 2003 at 10:27:23AM -0500, Kevin Cramer wrote:
> 
> If I put a System.out.println in the perform function, it never shows
> up in the logs.  I'm positive it is not being called but I can't
> figure out why.  I am using definitions and I saw a post from Cedric
> that you need to use tiles:insert to get it working but I am doing
> this in my JSP.
> 
> Any ideas?
> 
> Thanks,
> Kevin
> 
> On Tue, Mar 25, 2003 at 09:54:16PM -0700, David Graham wrote:
> > 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
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
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