You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cedric Dumoulin <ce...@apache.org> on 2003/02/08 17:53:50 UTC

Re: [TILES] controllerClass on definitions

  Hi,

  In a general manner, processing related to the business should be in 
the business layer (in beans associted to the business),  and processing 
related to the rendering (control and view) should be in the webapp 
layer (struts, tiles, ...).
  In your case, if you need to rearange or prepare the data to be 
rendered, it can be done in a struts action or in a tiles controller. 
Tiles controllers are designed to prepare data to be rendered by the 
tiles.  They are associated to a tiles in the tiles-config.xml file. An 
action can also be used to prepare data. An action is more generally 
associated to a jsp page, but can also be associated to a tiles in the 
struts-config.xml file.

  Choosing between using an action or a tiles controller depend of your 
design. Tiles controllers have been introduce to be able to prepare 
tiles data even if the tiles framework is use without struts. Tiles 
controllers still useful even if you use struts.

    Cedric

Etienne Labonté wrote:

>Hi, 
>
>Lets say I have this webapp based on Struts and Tiles. One page is for
>displaying the contents of a database table. So, of course, I created this
>small custom taglib to encapsulate the mechanics required for iterating
>through a ResultSet and displaying its records in a table.
>
>Now, new features have to be added like paging and editing. In an effort to
>keep the design clean, I wish to do some of the processing before the tags
>get evaluated like creating a beans collection with a subset of the
>ResultSet. I have to decide where this is going to happen...
>
>...in a bean, called from the JSP page with a reference to the pageContext
>or directly in the page as a scriptlet;
>
>...in a Struts action serving as a front to the JSP page;
>
>...in a descendant of org.apache.struts.tiles.Controller that is specified
>with the controllerClass attribute of a Tiles definition.
>
>...in some other place? Please tell me.
>
>I leave the first option out. I would like to keep the page simple and free
>of Java code whenever possible. It could also be said that this stuff
>doesn't belong in VIEW components. 
>
>Then I look for documented benefits of using the Tiles solution. I can't
>find any. I dig a while in Tiles'src and try to understand its inner
>workings... Finaly, I come to the conclusion it offers me no advantages over
>the Struts Action. Have I missed something?
>
>Perhaps I should keep the Tiles solution for times where I want to have
>access to Tiles definitions programmaticaly. What do you think?
>
>
>Etienne
>
>  
>


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