JSF Tiles Stylesheet solution

This is just a post for other newbies (like me !) out there who might have struggled with integrating JSF & Tiles. It turns out my problem was not integration related at all & nor was it related to JSF (probably) or Tiles. I just did not know how to load a stylesheet correctly. The way I did it the first time was:
<head>
<link rel="stylesheet" href="./config/styles.css" type="text/css"/>
</head>
This worked fine the first time the page was displayed. Now if there was a validation error JSF would re-display the same page with all styles missing. The page would have the correct Tiles layout nonetheless.
After much searching up all the wrong alleys (such as integration between the two etc.), I finally arrived at the correct way to load the .css file:
<head>
<link rel="stylesheet" href="<%=request.getContextPath()%>/config/styles.css" type="text/css" />
</head>
Now the path is derived from the contextPath of the application each time and the pages do not lose their styles.
...just in case someone else hits this and ends up looking here.
Ciao, Bhishma

Thanks Bhishma your solution was very usefull, I wish to know if you have some blog or something where I could write to you, for to be in touch and share experiences from our countries, sorry for my bad english

Similar Messages

  • JSF, tiles, xml and xsl

    Good days people, I am employed at an app that wants to integrate JSF, tiles, xml and xsl.
    Basically the app receives information of the user's interfaz, builds an url with the above mentioned information and invokes to a service web that a xml returns with the information. The idea is to generate the exit in format html or wml with an insole(staff) xsl and to send the result in this format to every jsp that is going to form a part of the page that it will generate tiles. at first I understand that it is feasible, i�d like to know if someone already has done it and since it has done it.
    Just now what I have is a managed bean that receives the parameters of the altar frontal and invokes a method of a service, like this:
    public String encuentra(){
    //deja los atributos privados rellenos.
    String mensaje ;
    crearYRellenarBusquedaVO();
    try {
    setResultado(this.getServicio().obtenerResultadosWML(this.getBusquedaVO()));
    mensaje="succesNoJS";
    }catch(java.lang.IllegalArgumentException e){
    mensaje="error";
    }catch(es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException e1){
    mensaje="error";
    }catch(Exception e2){
    mensaje="error";
    return mensaje;
    public String obtenerResultadosWML(es.yell.frontlite.service.impl.BusquedaVO busquedaVO){
    if (busquedaVO == null){
    throw new IllegalArgumentException(
    "obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO) - 'busquedaVO' no puede ser nulo.");
    try{
    return this.manejarObtenerResultadosWML(busquedaVO);
    }catch(es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException e1){
    throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException(
    "Error ejecutando el servicio String obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO). " + e1.getCause(),e1);
    }catch(Exception e){
    throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException(
    "Error ejecutando el servicio String obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO). " + e.getCause(),e);
    //it returns html code!
    protected String manejarObtenerResultadosWML(es.yell.frontlite.service.impl.BusquedaVO busquedaVO)
    throws java.lang.Exception{
    try{
    // xmlOrigen has full xml response from server
    String xmlOrigen = manejarObtenerResultadosJSActivado(busquedaVO);
    Source xmlSource = new StreamSource(new StringBufferInputStream(xmlOrigen));
    Source xsltSource = new StreamSource(SrvBusquedaNoxtrumServiceImpl.class.getResourceAsStream(Constantes.XSL_FILE));
    StringWriter cadenaSalida = new StringWriter();
    Result bufferResultado = new StreamResult(cadenaSalida);
    TransformerFactory factoriaTrans = TransformerFactory.newInstance();
    Transformer transformador = factoriaTrans.newTransformer(xsltSource);
    transformador.transform(xmlSource, bufferResultado);
    System.out.println(cadenaSalida.toString());
    return cadenaSalida.toString();
    }catch(Exception e2){
    throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException (e2.getMessage());
    With this exit in html, since(as,like) how could i forward it towards a jsp especially?
    faces-config.xml
    <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
    <from-outcome>succesNoJS</from-outcome>
    <to-view-id>/jsDesactivado.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>error</from-outcome>
    <to-view-id>/error.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    index.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <f:view>
    <f:loadBundle basename="MessageResources" var="msg"/>
    <head>
    <title>
    ${msg.titulo}
    </title>
    </head>
    <body>
    <h:form id="formulario">
    Que:
    <h:inputText id="campoQue" value="#{yellProxy.campoQue}" />
    Donde
    <h:inputText id="campoDonde" value="#{ yellProxy.campoDonde}" />
    <h:commandButton id="boton" value="Encuentra" action="#{yellProxy.encuentra}"/>
    </h:form>
    </f:view>
    </body>
    </html>
    jsDesactivado.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri=" http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    " http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1>JSP Page</h1>
    jsDesactivado!!
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    <jsp:getProperty name="yellProxy" property="resultado"/>
    </body>
    </html>
    If you could pass me a simple example of use of an app that uses JSF, tiles, xml and xsl, i�be grateful
    regards a lot!

    We too (at Viking Freight) would also be very interested to see if anybody
    has produced such a useful series of classes...
    Frank Lees, Developer
    -----Original Message-----
    From: Amin, Kamran [mailto:kamran.aminframeworkinc.com]
    Sent: Wednesday, January 19, 2000 12:11 PM
    To: 'Forte User'
    Subject: (forte-users) XML and XSL in Forte
    Has anybody integrated an XSL parser with Forte. I know Forte provides us
    with an XML parser but that does not help with parsing XSL. There a lot of
    parsers written in JAVA but that will not integrate well with Forte. We
    need something that will be easy to integrate with Forte. This parser will
    take our XML and XSL to give us a result set. If anybody can comment on the
    subject or share some information I would appreciate it.
    thanks in advance.
    ka
    For the archives, go to: http://lists.sageit.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.sageit.com

  • JSF + Tiles :  Assertion Failed

    Hi,
    I'm running JDev 10.1.3 Developer Preview . I have jsf+tiles application.
    Here is run the time error messages:
    [ServletException in:/appHeader.jsp] Assertion Failed'
    {ServletException in:/appContent.jsp] Assertion Failed'
    [ServletException in:/appMenu.jsp] Assertion Failed'

    Do the JSF tile pages have a <f:view> </f:view> JSF component?
    Does the wrapper JSF also include an f:view?
    Replace f:view with h:panelGrid in the tiles.

  • Unable to display Popup page while using JSF Tiles

    Hi All,
    I am using JSF Tiles. In the body page i am trying to open a pop up page through java script. bt i got the 500 internal server error. The popup open properly when there is no html or core jsf tags. can anyone help me abt this problem.
    Thanks.

    For future JSP/Servlet related questions please use the JSP/JSTL forum or the Servlet forum. There are more experts.
    As to your problem: did you read a basic JSP/Servlet book/tutorial? Did you read the [Tomcat documentation|http://tomcat.apache.org/tomcat-6.0-doc/index.html]? Your problem more sounds like you missed something trivial.

  • Navigation issue using jsf, tiles, tomahawk  :loosing faces context

    Hi all,
    I enhanced my webapp using tomahawks jscookmenu.
    Triggering 1 menuItem the wanted pages displays correctly but the next click anywhere in the application shows this error:
    org.apache.jasper.JasperException: javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to  *.jsf (with the <servlet-mapping>-element), you need to access your pages as 'sample.jsf'. If you tried to access 'sample.jsp', you'd get this error-message.The web config is like that:
    <?xml version="1.0"?>
    <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>
              <description>Tiles MyFaces Config</description>
              <param-name>tiles-definitions</param-name>
              <param-value>/WEB-INF/tiles.xml</param-value>
         </context-param>
         <context-param> 
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
              <param-value>.jsp</param-value>
         </context-param>
         <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>server</param-value>
         </context-param>
         <context-param>
              <param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
              <param-value>off</param-value>
         </context-param>
         <!-- context-params mafaces -->
         <context-param>
              <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.RENDER_VIEWSTATE_ID</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.STRICT_XHTML_LINKS</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.CONFIG_REFRESH_PERIOD</param-name>
              <param-value>this is a bug in myfaces</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
              <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
              <param-value>/faces/myFacesExtensionResource</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.myfaces.ALLOW_JAVASCRIPT</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
              <param-value>false</param-value>
         </context-param>
         <!-- StartupServletContextListener -->
         <listener>
              <listener-class>
                   org.apache.myfaces.webapp.StartupServletContextListener
              </listener-class>
         </listener>
         <!-- Faces MyFacesExtensionsFilter -->
         <filter>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <filter-class>
                   org.apache.myfaces.webapp.filter.ExtensionsFilter
              </filter-class>
              <init-param>
                   <param-name>uploadMaxFileSize</param-name>
                   <param-value>1m</param-value>
              </init-param>
         </filter>
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <url-pattern>/faces/*</url-pattern>
         </filter-mapping>
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <url-pattern>*.jsf</url-pattern>
         </filter-mapping>
         <!-- 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>
         <!-- Faces Servlet Mapping -->
         <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
         <servlet>
              <servlet-name>imageServlet</servlet-name>
              <servlet-class>my.com.xplorer.gui.v.ImageServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>imageServlet</servlet-name>
              <url-pattern>/image/*</url-pattern>
         </servlet-mapping>
    </web-app>So I lost the faces context using the jscookmenu, I believe.
    My webapp uses tiles, and there is 2 navigation possibilities: tomahawaks jscookmenu and tomahawaks commandNavigation.
    Latter one runs ok, I do use
    <t:panelNavigation id="nav" styleClass="navigation"
         itemClass="navitem" separatorClass="navseparator" 
         activeItemClass="navitem_active" openItemClass="navitem_open">
         <t:commandNavigation action="#{newsHandler.userRequest}" value="#{newsHandler.rss_source_name[0]}">
              <f:param name="navigator"  value="/jsf/news.jsp" />
         </t:commandNavigation>
    </t:panelNavigation>for this kind of navigation I do not use any navigation rules in faces config. To dynamically include the desired faces page I do that:
    <%
         String s = (String)request.getParameter("navigator");
         if (s == null || s.length() == 0 ) {
              s =  "/jsf/explorer.jsp";
    %>
    <jsp:include page="<%=s %>" />That does work.
    Now like I said I did enhance the app by adding tomahawks jscookmenu.
    Therefore I use the following in another tile:
    <t:jscookMenu layout="hbr" theme="ThemeOffice" styleLocation="resources/css">
              <%/* Availaible jscookMenu themes: ThemeIE, ThemeMiniBlack, ThemeOffice, ThemePanel
                 Availaible jscookMenu layout: hbr, hbl, hur, hul, vbr, vbl, vur, vul
                 respect to Heng Yuan http://www.cs.ucla.edu/~heng/JSCookMenu
            */%>
      <t:navigationMenuItem id="nav_0" itemLabel="#{localz.Xplorer}" action="Xplorer" />
    </t:jscookMenu>For this kind of navigation I tried to use navigation rules and the following show the config:
         <navigation-rule>
           <from-view-id>/jsf/*</from-view-id>
            <navigation-case>
                <from-outcome>Xplorer</from-outcome>
                <to-view-id>/jsf/tileMain.jsp?navigator=/jsf/explorer.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>Tabs</from-outcome>
                <to-view-id>/jsf/tileMain.jsp?navigator=/jsf/tab.jsp</to-view-id>
            </navigation-case>
         </navigation-rule>That works for the first click. The desired page is shown. The nect click anywhere in the app then show the mentioned error.
    Using tiles I use this view-handler
    <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>One question is: can I use another view-handler on top of the above one? So I could extend com.sun.facelets.FaceletViewHandler and try my luck with this? Or is the solution pointed out just a millisecond from being ok, I just don�t see it?
    Maybe you need to know a bit more on how I use tiles:
    That is the page I start with. It inserts the tile shown underneath.
    <f:view locale="#{userLocale}">
         <f:loadBundle var="localz" basename="my.com.xplorer.gui.v.Lokalization" />
         <f:loadBundle var="bundle" basename="my.com.xplorer.gui.v.messages" />
         <f:subview id="tileMain">
              <h:form id="myJsfForm" styleClass="standard">
                        <tiles:insert definition="template" flush="false" />
              </h:form>
         </f:subview>
         <h:messages />
    </f:view>
    </html>The foolowing is the tile structure.
    The bodi tile is the dynamic part. Above you see that I dynamically load the pages into it.
    <t:htmlTag value="div" styleClass="pageLayout">
         <h:panelGrid columns="2" align="center" styleClass="pageContent">
              <f:facet name="header">
                   <f:subview id="header">
                        <tiles:insert attribute="header" flush="false" />
                   </f:subview>
              </f:facet>
              <t:htmlTag value="div" styleClass="pageMenu">
                   <f:subview id="menu">
                        <tiles:insert attribute="menu" flush="false" />
                   </f:subview>
              </t:htmlTag>
              <t:htmlTag value="div" styleClass="pageContentWoMenu">
                   <f:subview id="bodi">
                        <tiles:insert attribute="bodi" flush="false" />
                   </f:subview>
              </t:htmlTag>
              <f:facet name="footer">
                   <f:subview id="footer">
                        <tiles:insert attribute="footer" flush="false" />
                   </f:subview>
              </f:facet>
         </h:panelGrid>
    </t:htmlTag>Maybe you also need to know the tiles config?
    <tiles-definitions>
       <definition name="template" path="/jsf/tileTemplate.jsp">
              <put name="header"  value="/jsf/header.jsp"/>
          <put name="menu"    value="/jsf/menu.jsp"/>
          <put name="bodi"    value="/jsf/bodi.jsp"/>
          <put name="footer"    value="/jsf/footer.jsp"/>
       </definition>
       <definition name="/jsf/news.tiles" extends="template">
              <put name="bodi"  value="/jsf/news.jsp"/>
       </definition>
       <definition name="/jsf/explorer.tiles" extends="template">
              <put name="bodi"  value="/jsf/explorer.jsp"/>
       </definition>
       <definition name="/jsf/tab.tiles" extends="template">
              <put name="bodi"  value="/jsf/tab.jsp"/>
       </definition>If you have read until here: thanks very much.
    There seems to be a sort of gap regarding jsf navigation documentation.
    I mean the ordinary way is covered everywhere (the book I have covers that too), but jscookmenu seems not to fit in too good. I also tried it with an actionslistener in the jscookmenu but that failed, too. So a link to documents telling the truth on jsf navigation I would appreciate very much.
    Kind regards
    Belle Ile En Mer

    This is the error i am getting into now..
    exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /welcomeJSF.jsp at line 19
    16: This file is an entry point for JavaServer Faces application.
    17: --%>
    18: <body>
    19: <f:view>
    20: <h3><h:outputText value="CHOULTRY'S IN BANGALORE" /></h3>
    21: <h:form>
    22: <table border="0">
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause
    java.lang.RuntimeException: Cannot find FacesContext
         javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1811)
         javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1628)
         org.apache.jsp.welcomeJSF_jsp._jspx_meth_f_005fview_005f0(welcomeJSF_jsp.java:112)
         org.apache.jsp.welcomeJSF_jsp._jspService(welcomeJSF_jsp.java:86)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

  • Problems with JSF&Tiles (displaying twice one inserted page in tiles)

    I'm using Tiles framework withih Dynamic Web Project in Websphere (WSAD 5.1.1), the project is based on JSF.
    - included tiles.jar in WEB-INF/lib directory
    - in web.xml defined servlet action as: <servlet>
              <servlet-name>action</servlet-name>
              <display-name>TilesServlet</display-name>
              <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
              <init-param>
                   <param-name>definitions-parser-validate</param-name>
                   <param-value>false</param-value>
              </init-param>
              <load-on-startup>2</load-on-startup>
         </servlet> - also to Faces Servlet set value "load on startup" on 1
    - added struts-tiles.tld to WEB-INF folder
    - then I created index.jsp: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet"
         type="text/css">
    <TITLE>index.jsp</TITLE>
    <%-- jsf:codeBehind language="java" location="/JavaSource/codebehind/index.java" --%><%-- /jsf:codeBehind --%>
    </HEAD>
    <f:use_faces>
         <BODY>
         <TABLE border="1">
              <TBODY>
                   <TR>
                        <TD>
                             <tiles:insert page="/menu.jsp" flush="false"/>
                        </TD>
                        <TD>
                             <tiles:insert page="/content.jsp" flush="false"/>
                        </TD>
                   </TR>
              </TBODY>
         </TABLE>
         </BODY>
    </f:use_faces>
    </HTML> - menu.jsp and content.jsp inserted in index.jsp are not the same, and here is code for menu.jsp: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet"
         type="text/css">
    <TITLE>menu.jsp</TITLE>
    <SCRIPT type="text/JavaScript" language="JavaScript"
         src=".ibmjsfres/hxclient.js"></SCRIPT>
    <LINK rel="stylesheet" type="text/css"
         href=".ibmjsfres/css/stylesheet.css" title="Style">
    <%-- jsf:codeBehind language="java" location="/JavaSource/codebehind/menu.java" --%><%-- /jsf:codeBehind --%>
    </HEAD>
    <f:use_faces>
         <BODY><hx:script_collector>
         <h:form formName="form1" id="form1"><P><hx:panel_actionbar
                        id="actionbar1"><hx:panel_actionbar nestedTitleText="Sub-Panel Label" id="actionbar2"><hx:command_buttonex label="Command Label" id="button1" action="go_page01"></hx:command_buttonex><hx:command_buttonex label="Command Label" id="button2"></hx:command_buttonex></hx:panel_actionbar><hx:panel_actionbar nestedTitleText="Sub-Panel Label" id="actionbar3"><hx:command_buttonex label="Command Label" id="button3"></hx:command_buttonex><hx:command_buttonex label="Command Label" id="button4"></hx:command_buttonex></hx:panel_actionbar></hx:panel_actionbar></P></h:form>
         </hx:script_collector></BODY>
    </f:use_faces>
    </HTML>The problem is when I run application on server and go to index.jsp the resulting page is containing two times menu.jsp, instead once menu.jsp and once content.jsp.
    Also when you click on buttons in "second" menu.jsp it's like it was clicked on the "first and the original one". When you click navigation rules do apply.
    Can anyone help on this?
    Message was edited by:
    DeYo

    I haven't solved problem yet but so far I realised this:
    - the problem is that both menu.jsp and content.jsp have forms, with tags: <h:form formName="form1" id="form1">.
    I've tried renaming form and id, but it didn't worked, alo tried changing scope of managed beans for the two inserted jsp pages - still nothing.
    - also if the content.jsp is not containing form but other JSF components like Image or Hyperlink, that components are not being shown/rendered.

  • Tree2 in Tomahawk  and JSF Tiles Implementation

    hi All,
    right now i mfacing one problem. which arise due to tiles implementation in JSF with Tree2 component of Tomahawk. i had created one tree menu using Tree2.
    its working fine, but i was not able to highlight selected child node of tree menu as i m using tiles implementation so all pages gets reloaded on every click on jsp. thus color of that selected node becomes as it is.
    please note that i m using myfaces implementation.
    what i have written is as below:
    <t:tree2 id="wrapTree" value="#{frontPage.catTree}" var="node" clientSideToggle="true"
                             showRootNode="false" varNodeToggler="t">
                                  <f:facet name="parent-one">
                                  <h:panelGrid id="parentOne" columns="1" cellpadding="0" cellspacing="0" border="0">
                                            <h:commandLink styleClass="textorg" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                                  <h:outputText escape="false" value="#{node.description} "/>
                                       <f:param name="categoreId" value="#{node.identifier}"/>
                             </h:commandLink>
                                  </h:panelGrid>
                   </f:facet>
                   <f:facet name="top-parent">
                   <h:panelGrid id="topParent" columns="1" cellpadding="2" cellspacing="0" border="0" align="left">
                   <h:commandLink styleClass="txtbold" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                   <h:outputText escape="false" value="#{node.description} "/>
                   <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGrid>
                   </f:facet>
                   <f:facet name="child">
                   <h:panelGroup id="Child">
                             <h:commandLink styleClass="#{t.nodeSelected ? 'headerRedText':'txt1'}" actionListener="#{t.setNodeSelected}" immediate="true">
                   <h:outputText value="#{node.description}"/>
                        <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGroup>
                   </f:facet>
                             </t:tree2>
    please help me if u have solution of this problem.
    thank you.

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • JSF/Tiles: [java.lang.ClassNotFoundException: org.apache.tiles.servlets.Til

    Hi,
    I am working on JSF1.2 in SAP NetWeaver CE and I am using Tiles. Please help me to resolve the following issues.
    ~~~~~~~~~~~~~~~~~~~
    1. File:G:\ws_wd\ce_ws.jdi\LocalDevelopment\DCs\demo.sap.com\lbsjsf\ear\_comp\gen\default\deploy\demo.sap.com~lbsjsf~ear.ear
         Name:lbsjsf~ear
         Vendor:demo.sap.com
         Location:localDevelopment
         Version:20090402105707
         Deploy status:Warning
         Version:NEW
         Description:
              1. Warning occurred on server 4585250 during deploy demo.sap.com/lbsjsf~ear : Web Class Existence Test: servlet class "org.apache.tiles.servlets.TilesServlet" cannot be found in the application class path. Possible reasons: 1) package or class name not correct; 2) missing referenced component (application or library); 3) missing reference to component (application or library)., file: demo.sap.com~lbsjsf~web.war#WEB-INF/web.xml, column 0, line 0, severity: warning
    Warning occurred on server 4585250 during deploy demo.sap.com/lbsjsf~ear : Web Class Existence Test: The servlet "com.cg.lbs.ui.controller.StartupConfigurationServlet" must implement "javax.servlet.Servlet"., file: demo.sap.com~lbsjsf~web.war#WEB-INF/web.xml, column 0, line 0, severity: warning
              2. Warning exception has been returned while the 'demo.sap.com/lbsjsf~ear' was starting. Warnings:
    Warning occurred on server 4585250 during startApp demo.sap.com/lbsjsf~ear : Cannot load servlet [org.apache.tiles.servlets.TilesServlet]. Error is: [java.lang.ClassNotFoundException: org.apache.tiles.servlets.TilesServlet
    ------------------------- Loader Info -------------------------
    ClassLoader name: [demo.sap.com/lbsjsf~ear]
    Living status: alive
    Direct parent loaders:
    [system:Frame]
    [service:servlet_jsp]
    [service:ejb]
    Resources:
    F:\usr\sap\CE1\J00\j2ee\cluster\apps\demo.sap.com\lbsjsf~ear\servlet_jsp\lbsjsf\root\WEB-INF\classes
    ++++++++++++++below is my web.xml+++++++++
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
         <display-name>
              LocalDevelopment~LocalDevelopment~lbsjsf(2fweb~demo.sap.com
         </display-name>
         <filter>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <filter-class>
                   org.apache.myfaces.webapp.filter.ExtensionsFilter
              </filter-class>
              <init-param>
                   <param-name>maxFileSize</param-name>
                   <param-value>20m</param-value>
              </init-param>
         </filter>
         <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
              <servlet-name>Faces Servlet</servlet-name>
         </filter-mapping>
         <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
         </filter-mapping>
         <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <url-pattern>*.jsf</url-pattern>
         </filter-mapping>
         <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>3</load-on-startup>
         </servlet>
         <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>2</load-on-startup>
         </servlet>
         <servlet>
              <servlet-name>StartupConfiguration</servlet-name>
              <servlet-class>
                   com.cg.lbs.ui.controller.StartupConfigurationServlet
              </servlet-class>
              <init-param>
                   <param-name>log4j-init-file</param-name>
                   <param-value>sswblog4j.xml</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.faces</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
              <welcome-file>index.html</welcome-file>
         </welcome-file-list>
    </web-app>

    That's a pretty decent error message. Have you eliminated the potential causes which were listed in the message?

  • 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.

    Hi,
    I'm trying to use Tiles with NetBeans 6.0. I used a similar set up as the other writer did, except for the JSP:root part:
    <jsp:root version="2.1"
    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">
    It complies and deploys OK, except it renders a blank page. The source code of the page is below. It seems that the "tiles:insertDefinition" was not expanded. Would you share some lights on how you get it to work. By the way I did not use shale-tiles, do I need it?
    Thanks in advance.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistate="http://www.w3.org/2005/07/aaa">
    <head>
    <meta content="no-cache" http-equiv="Pragma" />
    <meta content="no-cache" http-equiv="Cache-Control" />
    <meta content="no-store" http-equiv="Cache-Control" />
    <meta content="max-age=0" http-equiv="Cache-Control" />
    <meta content="1" http-equiv="Expires" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="/apogee-web-1.0-SNAPSHOT/theme/com/sun/webui/jsf/suntheme/css/css_master.css" />
    <script type="text/javascript">
    var djConfig = {
        "isDebug": false,
        "parseWidgets": false,
        "debugAtAllCosts": false
    </script>
    <script type="text/javascript" src="/apogee-web-1.0-SNAPSHOT/theme/META-INF/dojo/dojo.js"></script>
    <script type="text/javascript" src="/apogee-web-1.0-SNAPSHOT/theme/META-INF/json/json.js"></script>
    <script type="text/javascript" src="/apogee-web-1.0-SNAPSHOT/theme/META-INF/prototype/prototype.js"></script>
    <script type="text/javascript" src="/apogee-web-1.0-SNAPSHOT/theme/META-INF/com_sun_faces_ajax.js"></script>
    <script type="text/javascript">
    dojo.hostenv.setModulePrefix("webui.suntheme", "/apogee-web-1.0-SNAPSHOT/theme/com/sun/webui/jsf/suntheme/javascript");
    dojo.require('webui.suntheme.*');
    dojo.require('webui.suntheme.widget.*');
    dojo.require('webui.suntheme.widget.jsfx.*');
    </script>
    <link id="link1" rel="stylesheet" type="text/css" href="/apogee-web-1.0-SNAPSHOT/resources/stylesheet.css" />
    </head>
    <body id="body1" style="-rave-layout: grid" onload="" onunload="">
    <form id="form1" class="form" method="post" action="/apogee-web-1.0-SNAPSHOT/faces/Apogee.jsp" enctype="application/x-www-form-urlencoded">
    <tiles:insertDefinition flush="false" name="global.layout" />
    <input id="form1_hidden" name="form1_hidden" value="form1_hidden" type="hidden" />
    <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAAKVWTWwbRRR+Xmexm4LSOCgEiZRIFESFsk7bCyIUSFInsfBPZZsU2kM6Xk/sDevdYXbWXreiag+ABBcQIIEUBBIcemhP3HoAqh4QSEUiEhdOFReEBBwQEj8HYGZs79qOZZNkZD2vd957M98333vja7+A6lKYOJfaRDWkmcgqa9niJtbZ/JvfPP/hIeeoqQB4BAAiDoUTul3VHNfSNpCOHQ0RYho6YoZtaXmGGE4jC5UxTVaJeaRAMc7YJfz7xo3Prs+tfH63yFM/A2KsdOfBHsOWw7PwlDXEENX4PLEtbDFHO40oM5BZoKiGqYPMNQPXc7bNxCIQ3Vw3Svxz3HNegkug1Gdl/pl2/jouuoa26WwEGXnCMgaVcHusMyo0OGqVVU1QK9x2RSlDojAq8Shuu6LCg6NShvUiqCa3u1lr0S41QC1y2xWlDo5atmkV1A1uj3muiBJD8Z+iwRM//3GpEpcZpraKnEoaETXy/c1bk+e/DYOyDKOmjUrLSGc2TcIBVqHYqdhmySNPPyNT3FWPikSCAAZHRC6vpQC+My4mbem5XC6RKayvJRNn1nPZbEEsPsbg0TYCIQLhrHEcPKCIHKwt5RILhcQpGeTvUSp50bZNjKzbM/Tyd1t//6pA6CyoNWS62CMhBjP9dpBNn85mxB6Sp/I820SAeIFS1EgZDvOubE+//yX6IAyhJIw4xgUsCyRUHxHSY21teYSwQKACSUweyziIidHVQjq1vriQTy4xOBhfIHYZY342hC96KFg0ZevIxJf+HD+/NffXzwqMJCFa4dTrvLJSENFt12K0wSAmCzguYMfzjBpWeT4FUfHT5ZsRyz7A3WuIGshi8qdH/uWDATBQsCVeHe5mL2kxzIs59sNHn/xx5bXHFYG2xV57i9Iv41aLmL567d3pg+/ceaPdLkKEEF87oT7KUjuUJZ7u2SGSkHg9ISfv7eK3WYWdcu1pYS0Grm+v/fjT9MUVf08MIkXDKvG5YGsc9COdQghKQ7a0VS5gTPOi+bzw9acn3966nVZAScEB3USOk0HVNrmjDvcpyRgGk83jMOx4HnPKTeMCKpp4nkuCL3e4rWZsamuCz4RHeKmIBiiaWvjG1eKDD3/1nmiYFKaae9vpWh+9fO7OF/+8pUi3Cd8t8Pj4ldfzv53dflLCr5+AsYcutmQmBfry8DZJiCfQTfomJswUx7czUvrL6R4zUAXh3apACVQguiprd7ze5vVYO3S246jFU5zIr+NdhEhFDSFE3AAtQo76ZgAhTX/SB3TwNLb3ImheD/uELSgcBpv7tGCf9M0g2MI/OH1CAv9u0+/d/1BMJKCsl9vdgZcEDgEvbuIW+Gd9MwB805+IBn9/nJeh7VLeU+IOa5j8LsSYabrjBNuGPvju27skmrf4/iQhq2kIK+KfRouVp3wzgJWmf8/gd9asuM5nTdSwXfbETJkapZ4GEhsuh6m90yWu5rl90iUpH0KX+IvVokv3zQC6pH9nBe0YfUoF/gMrokC8ywsAAA==" />
    </form>
    <script type="text/javascript">
    webui.suntheme.common.body = new webui.suntheme.body('/Apogee.jsp', '/apogee-web-1.0-SNAPSHOT/faces/Apogee.jsp',null,null,'com_sun_webui_util_FocusManager_focusElementId');</script>
    </body>
    </html>

  • JSF & Tiles integration

    Hi Freinds,
    I m new to JSF and I m looking for some tutorial/article/guide or war file which uses the JSF implementation with tiles.
    Need urgently.
    Thanking in advance.
    regards,
    Novin

    Hello,
    i'm trying to use MyFaces+Tiles.
    I done this steps:
    1) put struts.jar in WEB-INF/lib
    2) add follow lines in web.xml
    <context-param>
            <param-name>tiles-definitions</param-name>
            <param-value>/WEB-INF/tiles-defs.xml</param-value>
    </context-param>
    <context-param>
         <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
         <param-value>.tiles</param-value>
    </context-param>
    <!-- Faces Servlet Mapping -->
         <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>/faces/*</url-pattern>
         </servlet-mapping>3) add follow in application tag of faces-config.xml
    <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>4) make file tiles-defs.xml and put it in WEB-INF dir, some its lines are
    <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration//EN"
           "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    <tiles-definitions>
        <definition name="layout.base" path="/index.jsp" >
            <put name="header" value="/header.jsp" />
            <put name="body" value="" />
            <put name="footer" value="/footer.jsp" />
        </definition>
        <definition name="/index.tiles" extends="layout.base" >
            <put name="body" value="/body_index.jsp" />
        </definition>
    ...5) index.jsp is this (partial)
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <%@ 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"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <f:view>
         <head>
              <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
              <title><f:verbatim>index</f:verbatim></title>
              <link rel="stylesheet" type="text/css" href="css/style.css" />
         </head>
         <body >
              <div id="topPanel">
                   <f:subview id="header">
                     <tiles:insert attribute="header" flush="false"/>
                   </f:subview>
              </div>
              <div id="bodyPanel">
                   <f:subview id="body">
                     <tiles:insert attribute="body" flush="false"/>
                   </f:subview>
              </div>
              <div id="footerPanel">
                   <f:subview id="footer">
                     <tiles:insert attribute="footer" flush="false"/>
                   </f:subview>
              </div>6) header.jsp follow
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <%@ 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"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <h:form>
         <ul>
              <li><h:commandLink action="login">Contattaci</h:commandLink></li>
              <li><h:commandLink action="login">Chi siamo</h:commandLink></li>
              <li class="active"><h:commandLink action="index">Home</h:commandLink></li>
         </ul>
    ...other pages are similar
    7) i used a html page for redirect it follow
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Refresh" content="0; URL=faces/index.tiles" />
    <title>Index</title>
    </head>
    <body>
    </body>
    </html>The problem is: the page displayed (after invoke index.html) is empty, no errors on server.
    Why?
    How i can solve?
    Regards.

  • JSF Tiles and Struts ActionForward

    Hi All
    I would like to use Tiles with my JSF application.
    In order to get the best from Tiles i would like to use definitions.
    the problem that most of the power of Tiles and definitions is coming from the use of ActionForward.
    Does any one now how i can implement ActionForward with struts definition name in the Navigation in JSF.
    I understand that i need to hack the Navigation model and get the Tiles bean from the Tiles using the outcome value.
    Then i know that i need some how to get the tree that generates and forward it to the JSF or somthing like this.
    Does any one have an idea how to do it???
    Thanks
    Noam

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • Jsf - tiles

    hi all!
    I'm developing a new application,and I'm using JSF.
    I want to use struts-tiles for the general layout of the page.
    can I use a tiles-defs.xml file like
    <definition name=".baseLayout" path="/WEB-INF/strutsTemplates/base-template.jsp">
    <put name="title" value="applicazione demo"/>
    <put name="navigation_bar" value="/WEB-INF/strutsTemplates/navigation_bar.jsp"/>
    <put name="navigation_menu" value="/WEB-INF/strutsTemplates/navigation_menu.jsp"/>
    <put name="footer" value="/WEB-INF/strutsTemplates/footer.jsp"/>
    <put name="body" value="/WEB-INF/strutsTemplates/white-body.jsp"/> <!-- pagina bianca-->
    </definition>
    <definition name="success.page" extends=".baseLayout">
    <put name="body" value="/WEB-INF/strutsTemplates/success.jsp"/>
    </definition>
    and then put in the pages <insert definition="..."/>
    or must I define the page like
    <tiles:insert name="myPage">
    <tiles:put name="myBody">
    anybody knows of any on-line resource on this argument?

    i've seen that it's possible to the TilesServlet for integrating tiles with JSF.
    i've wroted in the web.xml file this lines
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <!-- tiles servlet -->
    <servlet>
    <servlet-name>TilesServet</servlet-name>
    <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
    <init-param>
    <param-name>definitions-config</param-name>
    <param-value>/WEB-INF/tiles-defs.xml</param-value>
    </init-param>
    <!-- <init-param>
    <param-name>definitions-parser-validate</param-name>
    <param-value>true</param-value>
    </init-param>
    -->
    <load-on-startup>3</load-on-startup>
    But,if I search in the struts.jar file,I don't see any org.apache.struts.tiles.TilesServlet .
    Why?
    I use struts 1.2.4
    Before i've used tiles by pluggin-in in the struts-config file.

  • JSF+tiles+newbie = navigation problem.

    Hi all,
    I've got two pages: test.jsp, filter.jsp.
    I've got JSF forms on both of them.
    Code for the form is:
    <f:view>
    <h:form>
    <p>
    Riigi id: <h:inputText value="#{backing_test.id}"/>
    </p>
    <p>
    Kood: <h:inputText value="#{backing_test.kood}"/>
    </p>
    <p>
    <h:commandLink action="#{backing_test.goFilter}" value="action" />
    <h:commandButton value="push me" action="#{backing_test.goFilter}"/>
    </p>
    </h:form>
    </f:view>
    The idea was that I enter data into form, push the button and I'm forwarded to page with database info, selected according to parameters I've entered into form.
    Everything works fine until I uncomment
    <definition name="/test.tiles" extends="layout">
    <put name="body" value="/test.jsp"/>
    </definition>
    <definition name="/filtered.tiles" extends="layout">
    <put name="body" value="/filtered.jsp"/>
    </definition>
    in tiles.xml
    I haven't used tiles at all before, I can't understand - where is the error?
    May such data filter can be implemented in different way?

    This probably won't help much but it will reduce the amount of things you need to check to see what's going wrong.
    Remove the following from faces-config.xml:
    <navigation-case>
    <from-outcome>failure</from-outcome>
    <to-view-id>/test.jsp</to-view-id>
    </navigation-case>
    Then in your action return null during failure. Returning null means use the same page.

  • [ANN] JSF/Spring integration solution

    We developed a solution for integrating JSF with the Spring framework (http://www.springframework.org/), a well-designed, extensible and easy-to-use Java framework built around an Inversion of Control container (see http://martinfowler.com/articles/injection.html).
    Our glue code wraps the JSF context into a Spring context and thus merges them. This way, the JSF context becomes part of Spring and vice versa. This is done in a implementation independent way so that it can be used with any JSF implementation.
    For source code, documentation and an example application see http://sourceforge.net/projects/jsf-spring.
    Any comments are greatly appreciated!

    I'm experiencing problem in using the
    jsf-spring-2.4-example sample application. The
    following errors was returned:
    ============================================
    javax.servlet.ServletException:
    javax.servlet.jsp.JspException:
    org.springframework.beans.factory.BeanDefinitionStoreException:
    IOException parsing XML document from resource
    [WEB-INF/faces-config.xml] of ServletContext; nested
    exception is java.net.UnknownHostException:
    java.sun.com
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.showNames_jsp._jspService(showNames_jsp.java:91)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    org.springframework.web.jsf.RequestHandledFilter.doFilter(RequestHandledFilter.java:116)
    ============================================
    As far as I understand, the error was caused by some
    class within the sample application which tries to
    connect to the Internet. When I'm currently connected
    to the Internet which I cannot always do because I'm
    using a prepaid connection, the error suddenly
    disappear. This makes testing of the application
    difficult when constant Internet connection is absent.
    I hope you can shed light to me regarding this matter.
    Thank you very much!

  • JSF, Tiles, Spring

    Good days people, I take a couple of weeks trying to mount an example in the one that could join myfaces with tiles and spring without too much success. Could you comment on me the people who should have realized this task, which version of jars they used to integrate without problems?
    If it could not use tiles to form the cap of the sight, there are other alternatives to the use of tiles?
    regards!

    I'm assuming that since you are using JSF and Tiles, you are not using Spring's web framework. In that case, the integration of Spring with JSF is relatively trivial and you can neglect it for now. You might want to try the link below, if you are feeling lucky:
    http://www.google.com/search?q=myfaces+tiles

Maybe you are looking for