struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holman, Cal" <Cal.Hol...@paymentech.com>
Subject RE: Action Under a Tile?
Date Sun, 20 Jul 2003 15:23:08 GMT
Aaron>> Let's see - 

First question TilesAction does subclass Action - it is in the struts api.  It adds the tiles
context to the execute method. Then I extended the TilesAction to add a few items I needed
- mainly some logging set up.  TilesAction can be found in the org.apache.struts.tiles.actions
package.

Secondly - No because the TilesAction needs the tiles context you cannot use it like you would
a typical action.  Also my tiles portlets are not complete jsps with head/body type of tags
- they are meant to be imbedded in template jsp.

Next: The controllerURL is explained in some detail in the Advanced tutorial: http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf
I used this tutorial to create a portal type of site with four to five independent tiles.
Unfortunately Bell South can't find my house so my site is not available today our you could
see it in action at www.calandva.com .  I could put together a small war with a simple example
but will need Bell South to come back before you could download - hopefully this week although
their incompetence reaches a new level each day.

The reason I use the controllerURL technique is to avoid all the actions performing preparation
of beans for tiles that may or may not be needed.  The disadvantage is that no instead of
one action I am executing up to 5 actions - pretty expensive.  So I wrapped each tile in a
cache since most only change each 24 hours and at a minimum create the tile once per session.
 OSCache is a great tool for managing this type of tiles implementation since each tile can
have it's own caching schedule.

Lastly - I am not using this technique in "production" my company uses Struts and Tiles as
part of our web infrastructure and we have deployed several production sites using struts,
but none of them use this technique.  I am simply a hobbyist creating web sites for friends
and myself as a great way to keep up with technology allowing me to talk to my development
staff.  However, www.calandva.com does use these techniques - I can send you an email when
the darn thing is back up and you can see how it all works from a user point of view.

Cal 

http://www.calandva.com/ 

-----Original Message-----
From: Aaron Longwell [mailto:listservs@newmedialogic.com]
Sent: Sunday, July 20, 2003 00:49
To: Struts Users Mailing List
Subject: Re: Action Under a Tile?

Cal,

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
TilesAction?

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>
>
>
>Cal
>
>-----Original Message-----
>From: Aaron Longwell [mailto:listservs@newmedialogic.com]
>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
>Action.
>
>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/at-a-glance.do"/>
>
>I get the following error: Exception in /common/at-a-glance.do 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: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> 
>Learn more about Paymentech's payment processing services at www.paymentech.com
>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: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
> 
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

  
Learn more about Paymentech's payment processing services at www.paymentech.com
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message