forward to Tiles definition from faces-config.xml

Hello,

can anybody explain me how to make a forward to a Tiles definition from the faces-config.xml file? I磎 using MyFaces with Tomahawk and Tiles, but I also tried with Jsf without myFaces and lots of combinations but I can磘 fix it.

Here is my faces-config file:

<faces-config>

<navigation-rule>

<from-view-id>/pages/JP000.jsp</from-view-id>

<navigation-case>

<from-outcome>loginFrm</from-outcome>

<to-view-id>/JP002.tiles</to-view-id>

</navigation-case>

</navigation-rule>

<application>

<view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>

</application>

</faces-config>

and this is the tiles-defs.xml:

<tiles-definitions>

<!-- === layouts === -->

<definition name="general.menu"

path="/pages/tiles/templates/general.menu.jsp">

<put name="titleHTML" type="string"value="mi_title" />

<put name="menu" value="/pages/tiles/menu.jsp" />

</definition>

<!-- === pages === -->

<definition name="JP002.tiles" extends="general.menu">

<put name="titleHTML" type="string"value="mi_title" />

<put name="content" value="/pages/menus/JP002.jsp" />

<put name="menu" value="0" />

</definition>

</tiles-definitions>

Lots of thanks!!!!

[1529 byte] By [TxEmiXa] at [2007-11-27 5:16:21]
# 1

I'm facing the same problem, what I've posted the day before : 'JSF vs Struts...'. No resolution so far.

The only way I see working with JSF/Tiles is by using

<tiles:insert.../>, but this is not what we both are looking for.

It looks like JSF is always interpreting the content of the

<to-view-id>blah</to-view-id> as blah.jsp

Even better, if it's blah.foo, the result is still blah.jsp.

I can recall of using some plugin (with TilesHandler or something like that) in struts-config (earlier versions?) for allowing use of tiles - just a thought.

Unfortunately, I can't find sourcecode for JSF. That may help.

ivlad10a at 2007-7-12 10:38:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi,

If you are using tiles you should put in <from-view-id> *<from-view-id> .

I was using before tiles also, buit is good for struts.

I changed it to faceletes and it is much better.

Tiles doesnt;s work properlly with JSF RI.

With MyFaces is ok and it's working.

Alibaabaaa at 2007-7-12 10:38:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Just tried with <from-view-id>*</from-view-id> - the same result.I'm using jsf-1_1_01, probably will change to myFaces.Also, if this solution works, it's defeating the purpose. We don't want to loose flexibility in defining <from-view-id>.
ivlad10a at 2007-7-12 10:38:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I磛e just downloaded share framework (which includes myfaces1,1.4) from http://shale.apache.org/, and added shale-tiles.jar and it seems to work ok.

U can find an example here:

http://www.mail-archive.com/user@shale.apache.org/msg00770.html.

It磗 a good way to use Tiles and JSF/myfaces without struts.

TxEmiXa at 2007-7-12 10:38:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

I'm using Shale Tiles integration with JSF 1.2 and here are some tips:

In web.xml, make sure to have the servlet node and it must load after the faces servlet ...

<servlet>

<servlet-name>Tiles Servlet</servlet-name>

<servlet-class>org.apache.tiles.servlets.TilesServlet</servlet-class>

<init-param>

<param-name>definitions-config</param-name>

<param-value>/WEB-INF/tiles.xml</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

Your faces config should point to the TilesViewHandler ...

<view-handler>

org.apache.shale.tiles.TilesViewHandler

</view-handler>

wbossonsa at 2007-7-12 10:38:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Today I downloaded tomahawk-examples-1.1.5-bin. (http://myfaces.apache.org/download.html). They have one example with tiles, and it works the way I want it to.

I'm still trying to figure it out what is causing this behaviour.

At least, I tried to change the value they're using for linkage between <to-view-id> and tiles definition, and found that JSF is still ignoring the real value in <to-view-id>

: it was originally 'blah.jsp', but 'blah' or 'blah.tiles' worked the same way, while in tiles definition the corresponding name was always blah.tiles.

It seems that they are looking into tiles definitions first with the key composed of the first part of the value in <to-view-id> (before the dot) concatenated with hardcoded '.faces'.

I tried to change the key value in both config files to something like 'blah.ttt', and it did not work.

I'm not sure at the moment if this would be a problem for me, I may use this framework, knowing the limitations.

Also, I'll look into the code, if this may be altered and at what cost.

Still, the basic jsf problem with always interpreting the value in <to-view-id> as blah.jsp remains.

ivlad10a at 2007-7-12 10:38:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...