tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Schröder <simon.v...@gmx.de>
Subject Re: different tiles definition depending on the package of the action mapping [Struts 2]
Date Tue, 28 Oct 2008 15:11:58 GMT

> Wildcards and EL are not supported in the "extends" attribute.

ok, so this would be the alternative to the ViewPreparer:

<definition name="package_*.body_*" template="/layouts/basicLayout.ftl">
  <put-attribute name="menu" value="/tiles/{1}/common_menu.ftl" />
  <put-attribute name="body" value="/tiles/{1}/{2}.ftl" />
</definition> 


Antonio Petrelli-3 wrote:
> 
> 2008/10/28 Stephan Schröder <simon.void@gmx.de>:
>> <definition name="package_*.body_*" extends"{1}.layout">
> 
> Wildcards are not supported in the "extends" attribute.
> 
> 
>> <definition name="*" extends"${package}.layout">
> 
> EL is not supported in the "extends" attribute.
> 
>> But is there an expression to compute the current package
>> with the EL?
> 
> No.
> 
>> And how do i enable EL when i don't user the
>> http://tiles.apache.org/framework/tutorial/advanced/el-support.html
>> TilesServlet   but the TilesListener (because i want
>> FreeMarker-integreation)?
> 
> Simply replace the Servlet init parameters with context parameters.
> 
>> Do i have access to the value stack when using the EL?
> 
> Probably not.
> 
>> 3)using a ViewPreparer to create the right menu:
>> in this version i wouldn't have my three base layouts but only one with a
>> viewpreparer that initialises the menu structure
>> <definition name="*" template="/layouts/baseLayout.ftl"
>> preparer="MenuViewPreparer">
>>  <put-attribute name="menu" value="/tiles/dynamic_menu.ftl" />
>>  <put-attribute name="body" value="/tiles/{1}.ftl" />
>> </definition>
>>
>> So the MenuViewPrepare would by responsible to figure out which package
>> is
>> used. That should work like this:
>> public void execute(TilesRequestContext tilesContext, AttributeContext
>> attributeContext) {
>>  switch( ServletActionContext.getActionMapping.getNamespace() ) {
>>    case: ...
>> {
> 
> This could work.
> 
>> Which approach is preferable? Is there an even better approach?
> 
> The third, since it is the only that might work.
> 
>> I don't understand the "if you need"-part of this statement
>> http://tiles.apache.org/framework/getting_started.html "if you need JSP
>> support, copy the tiles-jsp-VERSION.jar in the WEB-INF/lib directory of
>> your
>> web application" .
>> Don't you always use the JSP-Tags at least in your baseLayout-File?
>> I guess i also have to include this when using FreeMarker because i call
>> the
>> JSP-Tags from within FreeMarker too!?
> 
> Well you are right :-) In fact that sentence is there for a future
> support of Velocity in Tiles.
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/different-tiles-definition-depending-on-the-package-of-the-action-mapping--Struts-2--tp20207395p20209009.html
Sent from the tiles users mailing list archive at Nabble.com.


Mime
View raw message