JSF,Tiles, Sun App Server and NetBeans 5.5

hi all,

here is my environment :

1.Server - Sun Application Server (Running On Suse Linux OS)

2.IDE - NetBeans 5.5

3.Project - JSF with Tiles

here i found topic about tiles and jsf :

http://forum.java.sun.com/thread.jspa?threadID=643536&messageID=3792238

but i think that Tiles is best alternative for JSF Layout Manager (It's my mind).

is there anybody help me how to integrate tiles with jsf ?

here is my example :

1.web.xml :

<servlet>

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

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

<init-param>

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

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

</init-param>

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

</servlet>

2. tiles-def.xml :

<tiles-definitions>

<!--****************************************************************-->

<!-- Global Layout-->

<!--****************************************************************-->

<definition name="global.layout" path="/pages/Mylayout/layout.jsp">

<put name="title" value="Magti Billing System" type="string"></put>

<put name="subtitle" value="Magti Billing System" type="string"></put>

<put name="header" value="/pages/Mylayout/header.jsp"></put>

<put name="subheader" value="/pages/Mylayout/sub_header.jsp"></put>

<put name="footer" value="/pages/Mylayout/footer.jsp"></put>

<put name="body" value="/pages/Mylayout/body.jsp"></put>

<put name="left_menu" value="/pages/Mylayout/left_menu.jsp"></put>

</definition>

</tiles-definitions>

3.and then i have 5 blank jsp pages : body.jps, footer.jsp, header.jsp, layout.jsp, left_menu.jsp, sub_header.jsp.

4. here is my layout.jsp code :

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

<jsp:root version="1.2"

xmlns:f="http://java.sun.com/jsf/core"

xmlns:h="http://java.sun.com/jsf/html"

xmlns:jsp="http://java.sun.com/JSP/Page"

xmlns:webuijsf="http://www.sun.com/webui/webuijsf"

xmlns:tiles="http://jakarta.apache.org/struts/tags-tiles"

>

<tiles:importAttribute scope="request"></tiles:importAttribute>

<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

<f:view>

<webuijsf:page binding="#{pages$Mylayout$layout.page1}" id="page1">

<webuijsf:html binding="#{pages$Mylayout$layout.html1}" id="html1">

<webuijsf:head binding="#{pages$Mylayout$layout.head1}" id="head1">

<webuijsf:link binding="#{pages$Mylayout$layout.link1}" id="link1" url="/resources/stylesheet.css"/>

</webuijsf:head>

<webuijsf:body binding="#{pages$Mylayout$layout.body1}" id="body1" style="-rave-layout: grid">

<webuijsf:form binding="#{pages$Mylayout$layout.form1}" id="form1">

<h:panelGrid columns="2" cellspacing="0" cellpadding="0"

border="0" styleClass="maingrid" columnClasses="maingrid">

<f:facet name="header">

<f:subview id="header">

<h:panelGrid columns="1" cellpadding="0" cellspacing="0">

<tiles:insert attribute="header" flush="false" />

<tiles:insert attribute="subheader" flush="false" />

</h:panelGrid>

</f:subview>

</f:facet>

<f:subview id="left_menu">

<tiles:insert attribute="left_menu" flush="false" />

</f:subview>

<f:subview id="body">

<tiles:insert attribute="body" flush="false" />

</f:subview>

<!--

<f:facet name="footer">

<f:subview id="footer">

<tiles:insert attribute="footer" flush="false" />

</f:subview>

</f:facet>

-->

</h:panelGrid>

</webuijsf:form>

</webuijsf:body>

</webuijsf:html>

</webuijsf:page>

</f:view>

</jsp:root>

5. and at last i have index.jsp:

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

<jsp:root version="1.2"

xmlns:f="http://java.sun.com/jsf/core"

xmlns:h="http://java.sun.com/jsf/html"

xmlns:jsp="http://java.sun.com/JSP/Page"

xmlns:webuijsf="http://www.sun.com/webui/webuijsf"

xmlns:tiles="http://jakarta.apache.org/struts/tags-tiles"

>

<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

<f:view>

<webuijsf:page binding="#{pages$main$index.page1}" id="page1">

<webuijsf:html binding="#{pages$main$index.html1}" id="html1">

<webuijsf:head binding="#{pages$main$index.head1}" id="head1">

<webuijsf:link binding="#{pages$main$index.link1}" id="link1" url="/resources/stylesheet.css"/>

</webuijsf:head>

<webuijsf:body binding="#{pages$main$index.body1}" id="body1" style="-rave-layout: grid">

<webuijsf:form binding="#{pages$main$index.form1}" id="form1">

<tiles:insert definition="global.layout" flush="false"/>

</webuijsf:form>

</webuijsf:body>

</webuijsf:html>

</webuijsf:page>

</f:view>

</jsp:root>

but i get an error like this :

Can't leverage base class

java.lang.IllegalStateException

at com.sun.faces.taglib.jsf_core.ViewTag.getComponentType(ViewTag.java:259)

at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:219)

at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:458)

at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:643)

at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1070)

at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:180)

at org.apache.jsp.pages.Mylayout.layout_jsp._jspx_meth_f_view_0(layout_jsp.java:140)

at org.apache.jsp.pages.Mylayout.layout_jsp._jspService(layout_jsp.java:99)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)

Any Ideas Is Usefull. Thanks.

Paata.

[9280 byte] By [paataa] at [2007-11-26 15:57:20]
# 1
there is one reason why i think that tiles better then facelets.facelet knows only sun application server(glassfish)
paataa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
is anybody use both sun application server and tiles ?
paataa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Yes, I'm using jsf tiles netbeans and glassfish. First off make sure that all of your namespace definitions are current, such as ...

jsp:root version="2.0" xmlns:f="http://java.sun.com/jsf/core"

xmlns:h="http://java.sun.com/jsf/html"

xmlns:jsp="http://java.sun.com/JSP/Page"

xmlns:ui="http://www.sun.com/web/ui"

xmlns:tiles="http://struts.apache.org/tags-tiles"

Try that and then get back to me.

..\w

wbossonsa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
wbossonscan you tell me which library jars is needed for tiles ?i get tiles library jars from shale framework.is it enough ?Regards ,Paata
paataa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
You need commons-beanutils,commons-digester, commons- el and commons-logging. ..\W
wbossonsa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
i tnink u use struts.jar library for tiles ?this libraries doesnot contains tiles :commons-beanutils,commons-digester, commons- el and commons-logging
paataa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

No, I'm using Shale. The namespace definition is correct, but it is for the use of Shale standalone, whose origins are in Struts.

These are the other jars I package for tiles:

shale-tiles-1.0.4.jar *, and tiles-core-2.0-SNAPSHOT.jar

*Please note that shale tiles 1.0.4 that I'm using is modified to work in the JSF 1.2 world.

wbossonsa at 2007-7-8 22:18:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...