I finally got a tiled page to display after trying a multitude of server
and jar versions as well as defining the correct tile contents with
appropriate jsf tags and attributes and getting past an
IllegalStateException caused by incorrectly having a view tag wrapping
the contents of a tile that was being inserted. I learned the hard way
that there can only be one---view tag pair per page---and that inserted
tiles are, of course, part of a single page (obvious now, but trees vs.
forest bit me).

At this point however I have not succeeded in accomplishing what you
describe below in your index.jsp page where you forward directly to an
extended tile. I can't seem to get it to work. I have the following test
setup:

index.jsp:
.....................................................................................................................................................
<!-- jsp:forward page="/contentPage.faces"/ -->
<jsp:forward page="/tiles/layouts/loadLayout.faces"/>
.....................................................................................................................................................

The commented out line above fails. The uncommented line above works. I
also tried the commented out line both with and without the leading
slash, although the TilesViewHandler javadoc states that the slash is
not needed.

/tiles/layouts/loadLayout.jsp:
.....................................................................................................................................................
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles" %>

<f:view>
    <tiles:insert name="/contentPage" flush="false" type="definition"/>
</f:view>
.....................................................................................................................................................

/tiles/layouts/siteLayout.jsp:
.....................................................................................................................................................

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles" %>

<html lang="en">
    <tiles:insert name="htmlHeader" flush="false"/>
   
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
style="margin:0;padding:0">
        <tiles:insert name="content" flush="false"/>
        <h:outputText value="Enter something here: "/>
        <h:inputText/>
    </body>
</html>
.....................................................................................................................................................

/tiles/htmlHeaderTile.jsp:
.....................................................................................................................................................

<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>

<head>
    <base href="http://localhost:8080/tilestest3";>
    <title><h:outputText value="This is a title."/></title>
    <meta name="keywords" content="keyword1 keyword2">
    <title><h:outputText value="Some title text."/></title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
.....................................................................................................................................................

/tiles/homeTile.jsp:
.....................................................................................................................................................

<h1 align="center">Content Tile!</h1>
<div>
    <p>
        A paragraph of content.       
    <p>
        A second paragraph of content.
    <p>
        A third paragraph of content.
</div>
.....................................................................................................................................................

tiles-defs.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>

        <!-- Display Definitions -->
   
    <definition name="/mainLayout" path="/tiles/layouts/siteLayout.jsp">
        <put name="htmlHeader" value="/tiles/htmlHeaderTile.jsp"/>
    </definition>

    <definition name="/contentPage" extends="/mainLayout">
        <put name="content" type="template" value="/tiles/homeTile.jsp"/>
    </definition>

</tiles-definitions>
.....................................................................................................................................................

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>

  <!-- Point to the tile view handler.  -->
  <application>
        <view-handler>org.apache.shale.tiles.TilesViewHandler</view-handler>
  </application>
 
<navigation-rule>
</navigation-rule>

</faces-config>
.....................................................................................................................................................

There are no navigation rules defined. I'm just trying to put up a page
that doesn't need to go anywhere for this test. As stated above the
example webapp works with the one jsp forward but not with the other.

When I switch the forwards in index.jsp, I wrapped the contents of
siteLayout.jsp, after the taglib defs of course, with an
<f:view>stuff</f:view> tag pair, but I got no server errors and nothing
rendered in the browser---no resulting html source at all.

Do you or does anyone else see what am I failing to do or how my
approach is significantly different?

I'm running on Suse Linux 9.3 with glassfish v2_b20 patched with JSF
1.2_02, shale 1.04 snapshot from 10Oct2006. The jars in WEB-INF/lib are
as follows:
commons-beanutils-1.7.0.jar
commons-chain-1.1.jar
commons-digester-1.7.jar
commons-logging-1.1.jar
jsf-api.jar
jsf-impl.jar
shale-core-1.0.4-SNAPSHOT.jar
shale-spring-1.0.4-SNAPSHOT.jar
shale-tiles-1.0.4-SNAPSHOT.jar
spring-beans-1.2.8.jar
spring-context-1.2.8.jar
spring-core-1.2.8.jar
spring-web-1.2.8.jar
tiles-core-2.0-SNAPSHOT-20060922.jar

[EMAIL PROTECTED]:~> java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

                                -=> Gregg <=-

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to