FW: Missing attribute

View: New views
9 Messages — Rating Filter:   Alert me  

FW: Missing attribute

by Hehl, Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I've been debugging the tiles code and have made some progress.

 

I have four tiles that make up a single html page. The tile at the top (header) has three attributes and the tile in the middle (body, the one that is using an attribute for the first time) is in the middle and has one.

 

When I run through the InsertAttributeTag for the header I can see all of the attributes listed below, e.g., logoutErrorKey, titleKey, body, etc. in the attributes for evaluatingContext. When I run through the same code for the JSP in the middle, attributes is null. Any ideas why this may be happening?

 


From: Hehl, Thomas
Sent: Monday, August 25, 2008 2:33 PM
To: users@...
Subject: Missing key

 

I've been using tiles for about two years, but only on an app I inherited from someone else, so I'm still kinda a newbie.

 

I'm trying to extend a definition in my tiles so I can re-use an existing JSP and just add one error message. Here's the appropriate tiles entries:

 

 

  <definition name=".logout" extends=".baseDef">

      <put-attribute name="logoutErrorKey"      value="" />

      <put-attribute name="titleKey"            value="logout.title" />

      <put-attribute name="welcomeKey"          value="logout.welcome"/>

      <put-attribute name="menu"                value="/WEB-INF/view/logout_Menu.jsp" />

      <put-attribute name="body"                value="/WEB-INF/view/logout.jsp"/>

  </definition>

 

  <definition name=".logoutTimeout" extends=".logout">

      <put-attribute name="logoutErrorKey"      value="logout.timeout" />

  </definition>

 

Then I added this to my JSP:

 

            <tiles:insertAttribute name="logoutErrorKey"/>

 

I changed my app to forward to .logoutTimeout and I get the following error:

 

144623 ERROR org.apache.tiles.jsp.taglib.RoleSecurityTagSupport | Error executin

g tag: Attribute 'logoutErrorKey' not found.

org.apache.tiles.TilesException: Attribute 'logoutErrorKey' not found.

        at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute

Tag.java:112)

        at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport

.java:171)

        at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecur

ityTagSupport.java:75)

        at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTag

Support.java:80)

 

And I have no idea where to go next. Help, please?

 

Thom Hehl
Sr. eJuror Architect
ACS: Government Solutions

) Office (859) 277-8800 x 144
* Thomas.Hehl@...
1733 Harrodsburg Road
Lexington, KY 40504-3617

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and notify sender via e-mail at Thomas.Hehl@... or by telephone at 859-277-8800 ext. 144. Thank you.

 


Re: FW: Missing attribute

by Antonio Petrelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
>             <tiles:insertAttribute name="logoutErrorKey"/>

Excuse, but where did you put this code? Is it in the template of
".logoutTimeout" definition?

Antonio

Parent Message unknown RE: FW: Missing attribute

by Hehl, Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This code is in logout.jsp, which is the jsp that is inserted into the body.
We have a main layout that has tiles header, body, menu, footer. In this
instance, body, contains logout.jsp, which has this tag in it. Make sense?

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@...]
Sent: Tuesday, August 26, 2008 9:42 AM
To: users@...
Subject: Re: FW: Missing attribute

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
>             <tiles:insertAttribute name="logoutErrorKey"/>

Excuse, but where did you put this code? Is it in the template of
".logoutTimeout" definition?

Antonio

Parent Message unknown RE: FW: Missing attribute

by Hehl, Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It looks like when startContext runs, it, deep down, assigns the last
context in the context stack to evaluatingContext. When the main layout tile
runs, there are two items in the stack and the second (last) item is the one
we want. When startContext runs for the body/logout.jsp, the context we want
is still the second one, but now there are three in the stack and it returns
the third one instead.

Now, how do I fix this?

Thanks.

-----Original Message-----
From: Hehl, Thomas [mailto:Thomas.Hehl@...]
Sent: Tuesday, August 26, 2008 9:47 AM
To: 'users@...'
Subject: RE: FW: Missing attribute

This code is in logout.jsp, which is the jsp that is inserted into the body.
We have a main layout that has tiles header, body, menu, footer. In this
instance, body, contains logout.jsp, which has this tag in it. Make sense?

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@...]
Sent: Tuesday, August 26, 2008 9:42 AM
To: users@...
Subject: Re: FW: Missing attribute

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
>             <tiles:insertAttribute name="logoutErrorKey"/>

Excuse, but where did you put this code? Is it in the template of
".logoutTimeout" definition?

Antonio

Re: FW: Missing attribute

by Antonio Petrelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
> This code is in logout.jsp, which is the jsp that is inserted into the body.
> We have a main layout that has tiles header, body, menu, footer. In this
> instance, body, contains logout.jsp, which has this tag in it. Make sense?

Yes, the reason was under my nose and I did not find it :-D
In Tiles 2.0.x you cannot propogate an attribute to inner attributes.
Either try Tiles 2.1.0 (currently in test build phase) or create a
definition, put the attribute that you want and put it in place of the
"body" attribute.
BTW you can download Tiles 2.1.0 *test build* at:
http://people.apache.org/builds/tiles/2.1.0/

HTH
Antonio

Parent Message unknown RE: FW: Missing attribute

by Hehl, Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Again, I'm almost a newb to tiles. Please explain the create a definition
thing you're referring to below.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@...]
Sent: Tuesday, August 26, 2008 9:52 AM
To: users@...
Subject: Re: FW: Missing attribute

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
> This code is in logout.jsp, which is the jsp that is inserted into the
body.
> We have a main layout that has tiles header, body, menu, footer. In this
> instance, body, contains logout.jsp, which has this tag in it. Make sense?

Yes, the reason was under my nose and I did not find it :-D
In Tiles 2.0.x you cannot propogate an attribute to inner attributes.
Either try Tiles 2.1.0 (currently in test build phase) or create a
definition, put the attribute that you want and put it in place of the
"body" attribute.
BTW you can download Tiles 2.1.0 *test build* at:
http://people.apache.org/builds/tiles/2.1.0/

HTH
Antonio

Re: FW: Missing attribute

by Antonio Petrelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/8/26 Hehl, Thomas <Thomas.Hehl@...>:
> Again, I'm almost a newb to tiles. Please explain the create a definition
> thing you're referring to below.

Ok let's start from your original definitions:

  <definition name=".logout" extends=".baseDef">
      <put-attribute name="logoutErrorKey"      value="" />
      <put-attribute name="titleKey"            value="logout.title" />
      <put-attribute name="welcomeKey"          value="logout.welcome"/>
      <put-attribute name="menu"
value="/WEB-INF/view/logout_Menu.jsp" />
      <put-attribute name="body"
value="/WEB-INF/view/logout.jsp"/>
  </definition>

  <definition name=".logoutTimeout" extends=".logout">
      <put-attribute name="logoutErrorKey"      value="logout.timeout" />
  </definition>

Essentially you need to assign an attribute in "logout.jsp", present
in "body" attribute inside the ".logout" definition.
So let's define a new definition:

<definition name=".logoutBody" template="/WEB-INF/view/logout.jsp">
      <put-attribute name="logoutErrorKey"      value="logout.timeout" />
</definition>

And let's redefine the ".logoutTimeout" definition:

  <definition name=".logoutTimeout" extends=".logout">
      <put-attribute name="body"      value=".logoutTimeout" />
  </definition>

HTH
Antonio

Re: FW: Missing attribute

by Antonio Petrelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/8/26 Antonio Petrelli <antonio.petrelli@...>:
>  <definition name=".logoutTimeout" extends=".logout">
>      <put-attribute name="body"      value=".logoutTimeout" />
>  </definition>

Sorry! I meant:

     <put-attribute name="body"      value=".logoutBody" />

Antonio

Parent Message unknown RE: FW: Missing attribute

by Hehl, Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Awesome! I was just about to send you an e-mail asking if this is what you
meant. This means I must understand. YEAH!!!!

Thanks for the help.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@...]
Sent: Tuesday, August 26, 2008 10:09 AM
To: users@...
Subject: Re: FW: Missing attribute

2008/8/26 Antonio Petrelli <antonio.petrelli@...>:
>  <definition name=".logoutTimeout" extends=".logout">
>      <put-attribute name="body"      value=".logoutTimeout" />
>  </definition>

Sorry! I meant:

     <put-attribute name="body"      value=".logoutBody" />

Antonio
LightInTheBox - Buy quality products at wholesale price!