I appear to have successfully resolved my two page to one page problem.
I no longer need _any_ page, for instance the loadLayout.jsp page, that
contains a tiles:insertDefinition tag. I can simply jump directly to any
tiles definition name. This is how I had Struts/Tiles working before, so
this seems to be the best way to use Tiles with Shale and JSF. I have
posted a test webapp at:

http://www.lansdaletutoring.com/test

The home page at this location allows the user to jump to two different
tiles and, from each of them, back to the home tile and to also download
the test webapp war file.

I changed the index.jsp file to:

<jsp:forward page="/mainLayoutPage.faces"/>

My tiles-def.xml file is:

<?xml version="1.0" encoding="ISO-8859-1" ?>

 <!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
       "http://struts.apache.org/dtds/tiles-config_2_0.dtd";>

<tiles-definitions>

    <definition name="/mainLayoutPage"
template="/tiles/layouts/siteLayout.jsp">
        <put name="htmlHeader" type="template"
value="/tiles/htmlHeaderTile.jsp"/>
        <put name="header" type="template" value="/tiles/headerTile.jsp"/>
        <put name="content" type="template" value="/tiles/homeTile.jsp"/>
        <put name="rightSideBar" type="template"
value="/tiles/rightSideBarTile.jsp"/>
        <put name="footer" type="template" value="/tiles/footerTile.jsp"/>
    </definition>

    <definition name="/contactUsPage" extends="/mainLayoutPage">
        <put name="content" type="template"
value="/tiles/contactUsTile.jsp"/>
    </definition>

    <definition name="/aboutUsPage" extends="/mainLayoutPage">
        <put name="content" type="template" value="/tiles/aboutTile.jsp"/>
    </definition>

</tiles-definitions>

The homeTile.jsp file is:

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t" %>

<h:outputText value=
"<h4 align='center'>An OutputText Method to do a Content Tile!</h4>
    <div>
        <p>
            A paragraph of content.
        <p>
            A second paragraph of content.
    </div><br>
" escape="false"/>

<h:outputText value="Some JSF output text."/>

<f:verbatim>
    <h4 align='center'>A Verbatim Method to do The Same Content Tile!</h4>
    <div>
        <p>
            Another paragraph of content.       
        <p>
            Another second paragraph of content.
    </div><br>
</f:verbatim>
<h:outputText value="Some more JSF output text."/>

<h:outputText value="<br>" escape="false"/>
<h:outputLink value="/test/contactUsPage.faces">
    <h:outputText value="Contact Us"/>
</h:outputLink>
<h:outputText value="<br>" escape="false"/>
<h:outputLink value="/test/aboutUsPage.faces">
    <h:outputText value="About Us"/>
</h:outputLink>
<h:outputText value="<br>" escape="false"/>
<h:outputLink value="http://www.lansdaletutoring.com/test/files/test.war";>
    <h:outputText value="Download this Webapp's WAR File"/>
</h:outputLink>

As far as the org.apache.shale.tiles.TilesViewHandler goes, I don't seem
to need to declare it in faces-config.xml or anywhere else. I suppose it
is being automatically loaded when needed and doesn't need to be
declared. If you want to see the exact error message that does occur
when it is declared in faces-config.xml, just declare it in the exploded
test.war and go to the home page. I believe that it will still fail as
before when this is done. If not, let me know.

                                                    -=> Gregg <=-

Greg Reddin wrote:
> On 4/18/07, Gregg Leichtman wrote:
>>
>> I am also using the tiles listener from web.xml as follows:
>>
>>   <listener>
>>     <listener-class>
>>       org.apache.tiles.listener.TilesListener
>>     </listener-class>
>>   </listener>
>>
>> instead of the Shale tiles view handler (if this makes a difference) in
>> faces-config.xml:
>>
>>   <!-- application>
>>     <view-handler>
>>       org.apache.shale.tiles.TilesViewHandler
>>     </view-handler>
>>   </application -->
>>
>> which I could not get to work.
>
>
> [snip]
>
> The Shale/JSF/Tiles scheme that I currently have working seems really
>> clunky.
>>
>> Is there some way that I can reduce the two pages down to one page under
>> Shale/JSF/Tiles?
>
>
> If I understand the TilesViewHandler correctly it is supposed to work
> that
> way.  Similar to how TilesRequestProcessor translated a forward
> definition
> into a Tiles invocation.  I think TilesViewHandler is supposed to do
> something similar for Tiles 2 in a JSF environment.
>
> What sort of problems did you have with the ViewHandler?  BTW, I'm
> planning
> to upgrade Shale-Tiles to the latest "official" Tiles release once we get
> another one out.
>
> HTH,
> Greg
>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to