You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/11/08 15:03:46 UTC
Simple Question about Tiles
Hello there! I have a simple question on Tiles usage, hope I get some
advice here.
I know this is not the best usage for it, but we have a kinda of
emergency here...
I have a list that is going to be iterated, and the bean inside it
will be checked, depending on a certain flag a tiles definition will
be used to display the content, kinda like this:
<logic:iterate name="someList" id="someBean'>
<logic:equal value="SIMPLE" name="someBean" property="displayType">
<tiles:insert definition="def.simple"/>
</logic:equal>
<logic:equal value="COMPLEX" name="someBean" property="displayType">
<tiles:insert definition="def.complex"/>
</logic:equal>
And the list goes on ...
</logic:iterate>
Now, inside my tiles I need to access someBean. But I'm not being able
to do so, I get an exception: Cannot find bean: "someBean" in any
scope
Is it possible to do such thing? If not, would be nice to hear some ideas.
Best Regards
--
IBM Certified SOA Solution Designer
IBM Database Associate - DB2 UDB V8.1 Family
Sun Certified Enterprise Architect (Part I)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Simple Question about Tiles
Posted by Vinicius Carvalho <ja...@gmail.com>.
Doh, missed a <bean:define toScope> ...
regards
On 11/8/06, Greg Reddin <gr...@apache.org> wrote:
>
> On Nov 8, 2006, at 8:12 AM, Antonio Petrelli wrote:
>
> > Vinicius Carvalho ha scritto:
> >> I have a list that is going to be iterated, and the bean inside it
> >> will be checked, depending on a certain flag a tiles definition will
> >> be used to display the content, kinda like this:
> >>
> >> <logic:iterate name="someList" id="someBean'>
> >> <logic:equal value="SIMPLE" name="someBean" property="displayType">
> >> <tiles:insert definition="def.simple"/>
> >> </logic:equal>
> >> <logic:equal value="COMPLEX" name="someBean" property="displayType">
> >> <tiles:insert definition="def.complex"/>
> >> </logic:equal>
> >> And the list goes on ...
> >> </logic:iterate>
> >>
> >> Now, inside my tiles I need to access someBean. But I'm not being
> >> able
> >> to do so, I get an exception: Cannot find bean: "someBean" in any
> >> scope
> >
> > That's strange, in which scope did you put "someBean"? And how do
> > you access "someBean" in your tiles?
>
> Since the scope is not defined (can you define scope in the iterate
> tag? (It's ben a while)), I think someBean is in page scope. So,
> it's no longer in scope inside your tiles definition. You'll need it
> to be in request scope if you want everything to work the way you
> have it here.
>
> Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
IBM Certified SOA Solution Designer
IBM Database Associate - DB2 UDB V8.1 Family
Sun Certified Enterprise Architect (Part I)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Simple Question about Tiles
Posted by Greg Reddin <gr...@apache.org>.
On Nov 8, 2006, at 8:12 AM, Antonio Petrelli wrote:
> Vinicius Carvalho ha scritto:
>> I have a list that is going to be iterated, and the bean inside it
>> will be checked, depending on a certain flag a tiles definition will
>> be used to display the content, kinda like this:
>>
>> <logic:iterate name="someList" id="someBean'>
>> <logic:equal value="SIMPLE" name="someBean" property="displayType">
>> <tiles:insert definition="def.simple"/>
>> </logic:equal>
>> <logic:equal value="COMPLEX" name="someBean" property="displayType">
>> <tiles:insert definition="def.complex"/>
>> </logic:equal>
>> And the list goes on ...
>> </logic:iterate>
>>
>> Now, inside my tiles I need to access someBean. But I'm not being
>> able
>> to do so, I get an exception: Cannot find bean: "someBean" in any
>> scope
>
> That's strange, in which scope did you put "someBean"? And how do
> you access "someBean" in your tiles?
Since the scope is not defined (can you define scope in the iterate
tag? (It's ben a while)), I think someBean is in page scope. So,
it's no longer in scope inside your tiles definition. You'll need it
to be in request scope if you want everything to work the way you
have it here.
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Simple Question about Tiles
Posted by Vinicius Carvalho <ja...@gmail.com>.
Hi there Antonio, thanks for the quick response. I did not specified,
the code is pretty much the same I'm using (only the bean name is
other)
Inside my tiles I have this:
<%@ page language="java" contentType="text/html"
pageEncoding="ISO-8859-1"%>
<%@ include file="include/taglibs.jsp" %>
SIMPLE<br>
<bean:write name="someBean" property="title"/>
Regards
On 11/8/06, Antonio Petrelli <ap...@apache.org> wrote:
> Vinicius Carvalho ha scritto:
> > I have a list that is going to be iterated, and the bean inside it
> > will be checked, depending on a certain flag a tiles definition will
> > be used to display the content, kinda like this:
> >
> > <logic:iterate name="someList" id="someBean'>
> > <logic:equal value="SIMPLE" name="someBean" property="displayType">
> > <tiles:insert definition="def.simple"/>
> > </logic:equal>
> > <logic:equal value="COMPLEX" name="someBean" property="displayType">
> > <tiles:insert definition="def.complex"/>
> > </logic:equal>
> > And the list goes on ...
> > </logic:iterate>
> >
> > Now, inside my tiles I need to access someBean. But I'm not being able
> > to do so, I get an exception: Cannot find bean: "someBean" in any
> > scope
>
> That's strange, in which scope did you put "someBean"? And how do you
> access "someBean" in your tiles?
>
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
IBM Certified SOA Solution Designer
IBM Database Associate - DB2 UDB V8.1 Family
Sun Certified Enterprise Architect (Part I)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Simple Question about Tiles
Posted by Antonio Petrelli <ap...@apache.org>.
Vinicius Carvalho ha scritto:
> I have a list that is going to be iterated, and the bean inside it
> will be checked, depending on a certain flag a tiles definition will
> be used to display the content, kinda like this:
>
> <logic:iterate name="someList" id="someBean'>
> <logic:equal value="SIMPLE" name="someBean" property="displayType">
> <tiles:insert definition="def.simple"/>
> </logic:equal>
> <logic:equal value="COMPLEX" name="someBean" property="displayType">
> <tiles:insert definition="def.complex"/>
> </logic:equal>
> And the list goes on ...
> </logic:iterate>
>
> Now, inside my tiles I need to access someBean. But I'm not being able
> to do so, I get an exception: Cannot find bean: "someBean" in any
> scope
That's strange, in which scope did you put "someBean"? And how do you
access "someBean" in your tiles?
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org