You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yo...@bcbsri.org on 2004/01/14 21:57:30 UTC

Tiles scope problem

Hi group

I have a quick question for you. I really appreciate your time on this.

We are trying to migrate our existing static JSP project to using Tiles.

The question is this.

I have a Struts action class calling a forward to one of the JSPs. This JSP
does the Tiles insert for the body attribute. The "body" jsp iterates
through the collection and tries to retrieve the properties of the
collection. When I do this with Session scope, it works fine but with
request scope it fails.
Is there any way to make this work with "request" scope?

Thanks.

Following is the simple set up.

file bcbsriLayout.jsp

<%@ page language="java" %>
...
<tiles:insert attribute="header" />
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="leftnav"/>
...
<tiles:insert attribute="body"/>
<tiles:insert attribute="bottomnav"/>

File: eligibility.jsp (This jsp gets called from Struts action)

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%
      session.setAttribute("navCode","GN2.02.01");
%>

<tiles:insert definition="bcbsri.layout" >
      <tiles.put name="titleKey" value="title" />
      <tiles:put name="body" value="/eligibility.jsp" /> // the main JSP
calling the logic:iterate

</tiles:insert>


../eligibility.jsp
<logic:iterate scope="request" name="members" id="member">
<html:text size="30" readonly="true" style="border:1" name="member"
property="formattedFullNameByFirst"/>
      ...
      Access member properties   // *****Error member not defined
</logic:iterate>

File:testTile.xml

<!DOCTYPE tiles-definitions PUBLIC
  "-//Apache Software Foundation//DTD Tiles Configuration//EN"
  "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

<!--<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>-->
<tiles-definitions>
<definition  name="bcbsri.layout"  page="/bcbsriLayout.jsp" >
  <put name="titleKey" type="string" />
  <put name="header" value="/HeaderIncDyn.jsp" />
  <put name="topnav" value="/TopNavIncDyn.jsp" />
  <put name="leftnav" value="/LeftNavIncDyn.jsp" />
  <put name="body" type="page" />
  <put name="bottomnav" value="BottomNavIncDyn.jsp" />
</definition>

<definition  name="basic.tiles" page="/definitions.jsp" >
  <put name="title" value="Basic title"/>
  <put name="header" value="test1" />
  <put name="footer" value="test2" />
  <put name="menu"   value="test333333" />
  <put name="body"   value="test4" />
</definition>


</tiles-definitions>



The members collection gets populated by an Action class. If I change the
above scope to "session" and change my action class accordingly, this
works. But I would like to get it working with scope as request.

can you suggest a solution?

Thanks a lot.

Yogi
We are running into a following problem.





**********************************************************************
MAILSWEEPER

This e-mail and any files transmitted with are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.  If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution
or taking of any action in reliance on the information 
contained in this e-mail is prohibited.  If you have received 
this e-mail in error, please immediately notify your e-mail 
administrator. 

Blue Cross & Blue Shield of Rhode Island 
in state: 401.751.1673
out of state: 1.800.343.5743 
**********************************************************************


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


RE: Tiles scope problem

Posted by Richard Hightower <rh...@arc-mind.com>.
Check your action forward and make sure you don't have redirect="true".

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-----Original Message-----
From: Yogi_Shridhare/BCBSRI@bcbsri.org
[mailto:Yogi_Shridhare/BCBSRI@bcbsri.org]
Sent: Wednesday, January 14, 2004 1:58 PM
To: struts-user@jakarta.apache.org
Subject: Tiles scope problem


Hi group

I have a quick question for you. I really appreciate your time on this.

We are trying to migrate our existing static JSP project to using Tiles.

The question is this.

I have a Struts action class calling a forward to one of the JSPs. This JSP
does the Tiles insert for the body attribute. The "body" jsp iterates
through the collection and tries to retrieve the properties of the
collection. When I do this with Session scope, it works fine but with
request scope it fails.
Is there any way to make this work with "request" scope?

Thanks.

Following is the simple set up.

file bcbsriLayout.jsp

<%@ page language="java" %>
...
<tiles:insert attribute="header" />
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="leftnav"/>
...
<tiles:insert attribute="body"/>
<tiles:insert attribute="bottomnav"/>

File: eligibility.jsp (This jsp gets called from Struts action)

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%
      session.setAttribute("navCode","GN2.02.01");
%>

<tiles:insert definition="bcbsri.layout" >
      <tiles.put name="titleKey" value="title" />
      <tiles:put name="body" value="/eligibility.jsp" /> // the main JSP
calling the logic:iterate

</tiles:insert>


../eligibility.jsp
<logic:iterate scope="request" name="members" id="member">
<html:text size="30" readonly="true" style="border:1" name="member"
property="formattedFullNameByFirst"/>
      ...
      Access member properties   // *****Error member not defined
</logic:iterate>

File:testTile.xml

<!DOCTYPE tiles-definitions PUBLIC
  "-//Apache Software Foundation//DTD Tiles Configuration//EN"
  "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

<!--<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>-->
<tiles-definitions>
<definition  name="bcbsri.layout"  page="/bcbsriLayout.jsp" >
  <put name="titleKey" type="string" />
  <put name="header" value="/HeaderIncDyn.jsp" />
  <put name="topnav" value="/TopNavIncDyn.jsp" />
  <put name="leftnav" value="/LeftNavIncDyn.jsp" />
  <put name="body" type="page" />
  <put name="bottomnav" value="BottomNavIncDyn.jsp" />
</definition>

<definition  name="basic.tiles" page="/definitions.jsp" >
  <put name="title" value="Basic title"/>
  <put name="header" value="test1" />
  <put name="footer" value="test2" />
  <put name="menu"   value="test333333" />
  <put name="body"   value="test4" />
</definition>


</tiles-definitions>



The members collection gets populated by an Action class. If I change the
above scope to "session" and change my action class accordingly, this
works. But I would like to get it working with scope as request.

can you suggest a solution?

Thanks a lot.

Yogi
We are running into a following problem.





**********************************************************************
MAILSWEEPER

This e-mail and any files transmitted with are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.  If you are not the intended recipient,
you are hereby notified that any disclosure, copying, distribution
or taking of any action in reliance on the information
contained in this e-mail is prohibited.  If you have received
this e-mail in error, please immediately notify your e-mail
administrator.

Blue Cross & Blue Shield of Rhode Island
in state: 401.751.1673
out of state: 1.800.343.5743
**********************************************************************


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