struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Longwell <>
Subject Re: Action Under a Tile?
Date Sun, 20 Jul 2003 04:48:54 GMT

Thank you for your in-depth reply... I have a few questions about the 
implementation. You are referring to a TilesAction. Is this an extension 
of the Struts Action class. Does your /do/portalWhatsNew Action extend 

Secondly, the do/portalWhatsNew and the PortalWhatsNew.jsp are a 
self-contained entity? By this, I mean if I put /do/portalWhatsNew in my 
Address Bar, I would receive the <td>content</td> from the 
PortalWhatsNew.jsp, where the content comes from business logic which 
occurred in the portalWhatsNew Action?

What I'm gathering is that the real trick here is the controllerUrl 
attribute on the definition. My previous attempts looked similar to what 
you are doing below, but I was putting my Struts Action url in the path 
(or page, something like that) attribute. I am not familiar with the 
controllerUrl attribute. Can you explain that as well.

 From the context of your post, I think you've got the exact solution 
I'm looking for (a "What's New" page is very similar to the 
"At-a-Glance" concept I need to implement).

Essentially, it's a piece of common but dynamic content that appears on 
every page. The problem is that with struts alone, the data retrieval 
process for the common content would need to be added to each individual 
action (via inheritance most likely). I am considering an alternative to 
extend all my Actions from BaseAction and put some code to add data to 
the request before giving the actual Action control.... thus adding the 
data to every action.... then I just need to do an include or tile to 
present that data.

Do you use the below "Action under a tile" in production? Do you prefer 
your solution to the one I've suggested as an alternative for my problem?

Once again, thanks for your time.

Aaron Longwell

Holman, Cal wrote:

>Have you tried using a TilesAction?  Using an action tied to a definition allow for the
building of independent jsps - they not only have the html but they have an action attached
to them that can load any beans necessary for rendering.  You can then drop into any definition
or template a self contained tile.
>  <definition 	name="portal.whatsnew.pagedef" 
>  				controllerUrl="/do/portalWhatsNew" 
>  	path="/web/pages/portal/PortalWhatsNew.jsp"/>
>This page definition will call the /do/portalWhatsNew action - loading a bean with the
news items then insert the PortalWhstsNew.jsp that uses the bean from the tiles action to
populate a list of what's new items.  This way you can use the definition as an attribute
in any other definitions and not worry about the action rendering the 'real' page loading
the what's new items - the definition is a self defining jsp - action and jsp together.  If
you then wrap something like the OSCache around this definition in the master jsp template
you only have to create the jsp the first time.
>  <definition name="home.pagedef" 	extends="layouts.pagedef" >   
>	  <put name="title"  					value="home.title" />
>	  <put name="header" 				value="/web/includes/header.jsp" />
>	  <put name="index"   				value="/web/pages/home/HomeIndex.jsp" />
>	  <put name="indexMain"   		value="/web/includes/index.jsp" />
>	  <put name="content"   			value="/web/pages/home/HomeContent.jsp" />
>	  <put name="footer" 				value="/web/includes/footer.jsp" />
>    	  <put name="styleSheet" 			value="web/styles/Grey_StyleSheet.css" />
>    	  <put name="keywords" 			value="home.keywords"/>
>    	  <put name="crumbs" 				value="/web/includes/crumb.jsp"/>
>	  <put name="crumbtitle1" 			value="Home"/>
>	  <put name="crumblink1" 			value="/home/home"/>
>	  <put name="pagename"			value="home"/>
>	   <put name="defname"			value="home.pagedef"/>
>	  <put name="rightIndex" value="portal.whatsnew.pagedef"/>
>  </definition>
>And in the template jsp:
>               <td valign="top" class="IndexFill">
>               <oscache:cache key="portal">
>               <!-- **********Begin Right Navigation ********** -->
>                  <tiles:insert attribute="rightIndex" flush="false"/>
>               <!-- **********End Right Navigation ********** -->
>               </oscache:cache>
>               </td>
>-----Original Message-----
>From: Aaron Longwell []
>Sent: Friday, July 18, 2003 14:04
>To: Struts-User
>Subject: Action Under a Tile?
>I am intermediately experienced with Struts, but I hit a brick wall
>today trying to solve the following problem:
>I am about 90% finished with a web app for a client. In discussions
>yesterday they decided to add an "at-a-glance" section to each page of
>the web site. You can think of this as a news feed that will sit on the
>left sidebar, it will have the same information on every page, but
>generating the information will require some business logic, and thus an
>I can easily add the layout for this into the tile that services the
>pages on the site.... It will be a simple collection to iterate over, so
>the JSP is simple as well.
>The Complicated Part: adding a collection to the request scope for each
>of my existing actions. There are 15 actions existing.
>I dreamed that it would be possible to add a tiles definition that
>included the result of an Action as opposed to a JSP (well, more
>accurately, included a JSP after being sent through an action first).
>Essentially, this means 2 actions are executed on each request.... the
>request's action... and the action to populate the data sidebar.
>I tried to do this, by using a tag like this:
><tiles:put name="at-a-glance" value="/common/"/>
>I get the following error: Exception in /common/ Cannot
>forward after response has been committed
>I am intermediately experienced with servlets, and I know that servlet
>includes are somewhat possible... but I'm obviously not experienced
>enough to solve this problem. Thanks for your help!
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>Learn more about Paymentech's payment processing services at
>THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary
and confidential information intended only for the use of the recipient(s) named above.  If
you are not the intended recipient, you may not print, distribute, or copy this message or
any attachments.  If you have received this communication in error, please notify the sender
by return e-mail and delete this message and any attachments from your computer.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message