You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Farrell <df...@farrellconsultancy.com> on 2004/10/14 11:29:23 UTC

Passing non-simple Bean to tiles context?

Hi,

I'm attempting to use Tiles at present.

My layout page looks like this:

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<tiles:insert attribute="content"/>


the page that uses that layout has a bit like this:

<logic:iterate id="loopModule" name="contentModules">
    <tiles:insert page="contentmodules/layouts/template_layout.jsp" 
flush="false">
        <tiles:put name="content" 
value="/pages/cm/contentmodules/text_template.jsp"/>
        <tiles:put name="loopModule" beanName="loopModule"/>
        <tiles:put name="test" value="hi"/>
        </tiles:insert>
</logic:iterate>

the tile itself (as specificed in /text_template.jsp) looks like this

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
    <html:form action="/EditGenericContentModuleSubmit" method="POST">
        <html:textarea name="loopModule" property="textContent"/>
        <html:hidden name="loopModule" property="contentModuleId"/>
        <P>
        <html:submit value="Save Changes"/>
    </html:form>



the 'loopModule thing is something I put in the request from an Action.  
In the page that 'calls' everything loops round my module vector and 
each iteration of the loop is called loopModule.

I want the tile to render the form based on loopModule's parameters.

It doesn't work as it stands because the loopModule bean is not in the 
context available to the tile - because the logic:iterate tag puts the 
'loopModule' into the page context, not the request or session.

How do I pass the individula loopModule into the tiles context so that 
the form on the other side can manipulate it?

David



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


Re: Passing non-simple Bean to tiles context?

Posted by David Farrell <df...@farrellconsultancy.com>.
using <tiles:put allows you to pass a bean, but that bean has to be of 
type "string", "page" or "definition" as far as I'm aware.

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