aspose file tools*
The moose likes Struts and the fly likes Struts1 - tiles -cascading tiles:insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts1 - tiles -cascading tiles:insert" Watch "Struts1 - tiles -cascading tiles:insert" New topic
Author

Struts1 - tiles -cascading tiles:insert

Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
I can not determine how to use tiles to insert a page into a page which itself was the result of a tiles:insert

My main layout inserts a content page (<tiles:insert attribute="content-page-A" /> )

This page in turn inserts another page (<tiles:insert attribute="content-page-B" /> or <tiles:insert attribute="content-page-C" />) based upon users prior selection.

However, I get the message:
javax.servlet.jsp.JspException: Error - Tag Insert : No value found for attribute 'content-page-B'.
I am reasonably certain this is not the case due to the testing I did.


I beleive (from reading other web sites) that it is not possible to cascade tiles because the tiles attributes are not passed through to a subsequent layout page.

If this is the case, what recommendations do you have for alternative means of "cascading" tiles,

Thanks
Tim
E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Have you pushed the tiles variables to the second page?

In page A you might have something like:


Then in your header page you can have:
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

What version of tiles is this? With tiles 2 you can cascade ...

Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
Lucas,
Thanks. I am using Struts 1.
-Tim

Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

You can use Tiles 2 with Struts 1
Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
E Robb
Thanks for your suggestion and example. However, I am still having a problem.
1) tiles is giving me a "No tag found" error with the line <tiles:putAttribute.. />

2) Here is my tiles-defs.xml:




Here is a snippet from the main page:



Here is a snippet from the page identified by "body" (ResourceConfiguration.jsp):


I tried using the import statement as welll, but got the same error



The error I get is:
(I am using Netbeans on Linus)

Jan 7, 2011 4:14:54 PM org.apache.struts.tiles.taglib.InsertTag$InsertHandler doEndTag
SEVERE: ServletException in '/ResourceConfiguration.jsp': javax.servlet.jsp.JspException: Error - tag useAttribute : attribute 'config_page_content' not found in context. Check tag syntax
org.apache.jasper.JasperException: An exception occurred processing JSP page /ResourceConfiguration.jsp at line 87

84:
85:
86: <%-- Begin Column header layout --%>
87: <tiles:useAttribute name="config_page_content" ignore="false" />
88: <logic:notEmpty name="config_page_content">
89: <tiles:insert attribute="config_page_contentx" ignore="false" beanScope="request" />
90: </logic:notEmpty>

Thanks for your help, I really appreciate it.
Tim





E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Are you using tiles 2? I think Lucas had a good idea which cascade but it sounds like we are talking about two different deployments:

Tiles 1.0 uses for example
tiles:insert attribute="body"

The example I provided is tiles 2.0.6 which uses
tiles:insertAttribute name="body"

It could be your getting the errors because you are working on an older version of tiles than the advice I provided to you.

If you are working on a version earlier than 2.0 than that is what is causing the error.

Thanks,
Earl
Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
lucas and earl

Thanks. I upgraded to Tiles 2 per Struts web site migration page and get the following error:



Any clue?

Thanks agian
TIm
Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
Earl and Lucas:
Update
The above error was caused because I needed to add tiles-template to the project library.

I also discovered that the following need to be added:
slf4j-api-1.5.8.jar
slf4j-jdk14-1.5.8.jar

These were not mentioned in the Struts migration page.

Thanks
Tim

Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
I am now getting NullPointerExceptions on every line of the jsp file where <tiles:insertAttribute name="this_content.jsp/> and all other <tiles: xxxx > usage.

Here is the section of tiles-defs-sml


MainPage2.jsp:



Error:



Thanks for you help.
Tim
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

What does AdminMenuBar.jsp contain ... do you have any tiles:insertAttribute in there? If you do those would require a cascade="true" in the tiles config
Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
The AdminMenuBar.jsp contains only a set of drop down menus. It contains no reference to tiles.

The only tiles:inserted page which does contain another <tiles:insert ....> is, or could be based upon user option, the "body". But that should not blow up the whole page.

I am using a tiles Listener.

This message I got this morning seems to say that the attribute is not available to the page.



I must be missing something simple.

Thanks
Tim
Tim Kernan
Greenhorn

Joined: Aug 25, 2010
Posts: 16
I am closing this because the solution to the original problem was to convert to Tiles 2.

I am having trouble getting Tiles 2 to work and will deal with that separately.

Thanks for everyones help.
Tim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts1 - tiles -cascading tiles:insert
 
Similar Threads
Struts Tiles Inheritance problem
How to insert an image (gif) in a tile jsp and place it in the layout jsp?
Urgent : How to insert an image (gif) in a tile jsp and place it in the layout jsp?
can Layout JSPs in tiles be extended or reused ?
Access resources from jsp without using "bean:message" tag