A Tiles question, about putList I think

Posted on 2013-02-03
Last Modified: 2013-02-07
A complete newbie to Tiles, I have a page like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri='/WEB-INF/struts-tiles.tld' prefix='template' %>
<template:insert page='/template/template.jsp'>
  <template:put name='title' value='Foo - Bar Response'/>
  <template:put name='header' value='/template/header.jsp' />
  <template:put name='error' value='/template/error.jsp' />
  <template:put name='sidebar' value='/template/sidebar.jsp' />
  <template:put name='content' value='/content/providerInquiryResultsContent.jsp'/>
  <template:put name='footer' value='/template/footer.html' /> 

Open in new window

My requirement is to insert some additional jsp content -- for example moreStuff.jsp -- into the sidebar after /template/sidebar.jsp, which I cannot modify. As far as I can tell I do that with a putList, but what is the syntax?

As an aside I have not been able to find any central definition of templates as the tiles-defs.xml is almost empty and I don't see any other suspects. So I'm not clear whether I make changes here only or somewhere else first.
Question by:FelineConspiracy
LVL 35

Accepted Solution

mccarl earned 500 total points
ID: 38849915
I have not been able to find any central definition of templates as the tiles-defs.xml is almost empty
The definition IS the bit of JSP that you included in your question. The definition can be placed in the tiles-defs.xml file (where it can be reused) or it can be defined explictly in the JSP (as you have here).

Also, I don't think the putList tag will do what you want. Not without changing the /template/template.jsp file to actually handle the list. But if you are able to change that file (rather than sidebar.jsp), you would just change it to accept a 'sidebar2' attribute, and then you could add another <template:put ...  to the above to pass the .jsp for your additional content.

If you aren't able to modify either the sidebar.jsp or template.jsp then I think you are stuck. I can't think of any other way to do what you want!

Expert Comment

ID: 38857072
In Tiles we can define the definition in the tiles-defs.xml which specifies the different components to "plugin" to generate the output. This eliminates the need to define extra jsp file for each content file.

Here is interesting link

Author Closing Comment

ID: 38865285
Thank you. In this case I think I will reverse direction and bring sidebar.jsp into my page. My page is a special case in that there is no form for the user to fill out so I really cannot use the template profitably anyway.

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert ArrayList of custom objects to JSON 4 62
json example 39 150
Java asynchronous logging 4 61
iterator/ListIterator approach 17 27
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question