Hi Ryan,
Here is the configuration that works for me.
The versions of Shale and tiles is very critical. So, I will give you
the versions I am using.

JSF Version: 1.1 (MyFaces 1.1.6_SNAPSHOT taken 08/22/07 and tomahawk
1.1.7_SNAPSHOT taken 09/11/07)
Shale: 1.1.0_SNAPSHOT taken on 08/23/07. This snapshot has a version of
tiles (tiles-core-2.0-r468346-SNAPSHOT.jar). 
NOTE: I HAVE NOT added Spring Framework into the mix. 

As for the faces-config I have removed the references to the our
application.

Here is how my web.xml is configured.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
         version="2.4">
   
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>

    <context-param>
 
<param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
 
<param-name>org.apache.commons.chain.CONFIG_WEB_RESOURCE</param-name>
        <param-value>/WEB-INF/chain-config.xml</param-value>
    </context-param>

    <filter>
        <filter-name>shale</filter-name>
 
<filter-class>org.apache.shale.application.faces.ShaleApplicationFilter<
/filter-class>
    </filter>

    <filter-mapping>
        <filter-name>shale</filter-name>
        <url-pattern>*.faces</url-pattern>
    </filter-mapping>

    <context-param>
        <param-name>definitions-config</param-name>
        <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>

    <listener>
 
<listener-class>org.apache.shale.view.faces.LifecycleListener</listener-
class>
    </listener>

    <listener>
 
<listener-class>org.apache.tiles.listener.TilesListener</listener-class>
    </listener>

    <listener>
        <listener-class>
            org.apache.commons.chain.web.ChainListener
        </listener-class>
    </listener>

    <listener>
        <listener-class>
            org.apache.myfaces.webapp.StartupServletContextListener
        </listener-class>
    </listener>

    <filter>
        <filter-name>extensionsFilter</filter-name>
 
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-
class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>100m</param-value>
        </init-param>
        <init-param>
            <param-name>uploadThresholdSize</param-name>
            <param-value>10m</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>*.faces</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>/faces/*</url-pattern>
    </filter-mapping>

    <servlet>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.faces</welcome-file>
    </welcome-file-list>

</web-app>


faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
        "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
        "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>

<faces-config>

    <navigation-rule>
        <from-view-id>/firstTest.jsp</from-view-id>
        <navigation-case>
            <from-outcome>*</from-outcome>
            <to-view-id>/firstTest.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

</faces-config>


tiles.xml

<?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="test.definition"
template="/template/template.jsp">
      <put name="header" value="/common/header.jsp"/>
      <put name="footer"   value="/common/footer.jsp"/>
    </definition>

    <definition name="/firstTest" extends="test.definition" >
        <put name="body" value="/firstTest.jsp"/>
    </definition>


</tiles-definitions>
 

Try with this setup. Let me know if that works or if you run into
issues.

Thanks,
Sudhir

-----Original Message-----
From: Ryan, Scott [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 21, 2007 1:49 PM
To: user@shale.apache.org
Subject: Sample for using MyFaces Shale and Tiles

I have been trying to get the Shale Tiles extension inside my myfaces
application and have not had any luck.  There are a lot of conflicting
examples on the web and the page on the Shale site is blank.  I have the
following configuration but when I navigate to my page it merely
forwards to the standard JSP page rather than running it through the
tiles processor.  Can anyone point me to an example or tell me where I
have gone astray?  There are a number of examples that show using a
servlet in addition and other combinations.  If you can point me to a
sample application that would be good as well.

 

faces-config.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>

<faces-config>

    <application>

        <message-bundle>messages</message-bundle>

        <locale-config>

            <default-locale>en_US</default-locale>

        </locale-config>

    </application>

    <application>

        <variable-resolver>

 
org.springframework.web.jsf.WebApplicationContextVariableResolver

        </variable-resolver>

    </application>

    <!-- Tiles Integration -->

    <application>

        <view-handler>

            org.apache.shale.tiles.TilesViewHandler

        </view-handler>

    </application>

 

<!--  Navigation Rules -->

    <navigation-rule>

        <navigation-case>

            <from-outcome>LoginView</from-outcome>

            <to-view-id>/JSP/LoginView.jsp</to-view-id>

        </navigation-case>

        <navigation-case>

            <from-outcome>LogoutView</from-outcome>

            <to-view-id>/JSP/LogoutView.jsp</to-view-id>

            <redirect />

        </navigation-case>

        <navigation-case>

            <from-outcome>HomeView</from-outcome>

            <to-view-id>/JSP/HomeView.jsp</to-view-id>

            <redirect />

        </navigation-case>

    </navigation-rule>

</faces-config>

 

 

Web.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";

    version="2.4">

    <context-param>

        <param-name>javax.faces.CONFIG_FILES</param-name>

        <param-value>/WEB-INF/faces-config.xml</param-value>

    </context-param>

    <!-- Tiles -->

    <context-param>

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

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

    </context-param>

    <listener>

        <listener-class>

            org.apache.tiles.listener.TilesListener

        </listener-class>

    </listener>

    <!-- Faces Servlet -->

        <servlet>

  <             <servlet-name>Faces Servlet</servlet-name> 

  <
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 

  <             <load-on-startup>1</load-on-startup> 

         </servlet>

    <!-- Extension mapping -->

    <servlet-mapping>

        <servlet-name>Faces Servlet</servlet-name>

        <url-pattern>*.faces</url-pattern>

    </servlet-mapping>

 

 

Tiles-defs.xml

 

<tiles-definition>

    <tiles-definitions>

        <definition name="master.template"

            path="/templates/layout.jsp">

            <put name="header" value="/common/header.jsp" />

            <put name="menu" value="/common/navigation.jsp" />

        </definition>

        <!-- Tiles Page -->

        <definition name="/JSP/HomeView"

            extends="master.template">

            <put name="body" value="/JSP/HomeView.jsp" />

        </definition>

        <definition name="/JSP/LoginView"

            extends="master.template">

            <put name="body" value="/JSP/LoginView.jsp" />

        </definition>

        <!-- Non Tiles Page -->

        <!-- 

            <definition name="/JSP/LoginView"

            path="/JSP/LoginView.jsp" />

        -->

        <definition name="/JSP/Error" path="/JSP/Error.jsp" />

    </tiles-definitions>

</tiles-definition>

 

Thanks

 

Scott Ryan

Consultant

303 768-4051

 


------------------------------------------------------------------------
------
This e-mail transmission may contain information that is proprietary,
privileged and/or confidential and is intended exclusively for the
person(s) to whom it is addressed. Any use, copying, retention or
disclosure by any person other than the intended recipient or the
intended recipient's designees is strictly prohibited. If you are not
the intended recipient or their designee, please notify the sender
immediately by return e-mail and delete all copies. OppenheimerFunds
may, at its sole discretion, monitor, review, retain and/or disclose the
content of all email communications. 
========================================================================
======

Reply via email to