You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Per Jørgen Walstrøm <pe...@statnett.no> on 2006/08/03 17:22:37 UTC

Exposing an attribute using tiles

hello list,
I have the following code:

<tiles:insert definition="myLayout">
   <tiles:put name="body" type="string">
      <logic:iterate id="outageElement" name="searchForm" property="region1Papers">
         <tiles:insert page="/nextPage.jsp" flush="false"/>
      </logic:iterate>
   </tiles:put>
</tiles:insert>

and my nextPage.jsp contains this:
<bean:write name="outageElement" property="name"/>

When I run my code, I get the following error:
17:18:42,768 ERROR [Engine] ApplicationDispatcher[/oweb] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in 'nextPage.jsp': No bean found under attribute key outageElement

Does anyone know how I could make nextPage.jsp aware of the 'outageElement'? I have been experimenting with <tiles:useAttribute> and <tiles:importAttribute>, but just can't seem to get it to work...

Any suggestions would be highly appreciated!

cheers,
pj



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


Re: Exposing an attribute using tiles

Posted by Antonio Petrelli <br...@tariffenet.it>.
Per Jørgen Walstrøm ha scritto:
> <tiles:insert definition="myLayout">
>    <tiles:put name="body" type="string">
>       <logic:iterate id="outageElement" name="searchForm" property="region1Papers">
>          <tiles:insert page="/nextPage.jsp" flush="false"/>
>       </logic:iterate>
>    </tiles:put>
> </tiles:insert>
>
> and my nextPage.jsp contains this:
> <bean:write name="outageElement" property="name"/>
>   

Beans are not passed automatically to a tile, but they can be passed as 
attributes.

Rewrite the first piece this way:

<tiles:insert definition="myLayout">
   <tiles:put name="body" type="string">
      <logic:iterate id="outageElement" name="searchForm" property="region1Papers">
         <tiles:insert page="/nextPage.jsp" flush="false">
           <tiles:put name="outageElement" beanName="outageElement" />
         </tiles:insert>
      </logic:iterate>
   </tiles:put>
</tiles:insert>


And your nextpage.jsp will be:

<tiles:insert attribute="outageElement" />
<tiles:importAttribute name="outageElement" />

<bean:write name="outageElement" property="name"/>


HTH
Antonio


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


RE: Exposing an attribute using tiles

Posted by "Samere, Adam J" <as...@paychex.com>.
Tiles assembles pages using dynamic (runtime) inclusion. The logic:iterate tag defines a page scoped attribute under the key specified by the id tag attribute. The nextPage.jsp will have it's own pageContext, so the outageElement is not visible. Perhaps you could put the outageElement into request scope... 

-Adam

-----Original Message-----
From: Per Jørgen Walstrøm [mailto:per.walstrom@statnett.no] 
Sent: Thursday, August 03, 2006 11:23 AM
To: Struts Users Mailing List
Subject: Exposing an attribute using tiles

hello list,
I have the following code:

<tiles:insert definition="myLayout">
   <tiles:put name="body" type="string">
      <logic:iterate id="outageElement" name="searchForm" property="region1Papers">
         <tiles:insert page="/nextPage.jsp" flush="false"/>
      </logic:iterate>
   </tiles:put>
</tiles:insert>

and my nextPage.jsp contains this:
<bean:write name="outageElement" property="name"/>

When I run my code, I get the following error:
17:18:42,768 ERROR [Engine] ApplicationDispatcher[/oweb] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in 'nextPage.jsp': No bean found under attribute key outageElement

Does anyone know how I could make nextPage.jsp aware of the 'outageElement'? I have been experimenting with <tiles:useAttribute> and <tiles:importAttribute>, but just can't seem to get it to work...

Any suggestions would be highly appreciated!

cheers,
pj



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


-----------------------------------------
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.


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