Jsf and tiles

hi all.
i'm developing an application using jsf and tiles.
i've some problem in the general layout page.
how can I refer to images and files,if I don't know where the page will be used?
with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
I only use the TilesServlet.
any suggestion?
i've also try to define the url like "/css/mycss.css" but in local dosn't work.
thank a lot for any reply!

hi all.
i'm developing an application using jsf and tiles.
i've some problem in the general layout page.
how can I refer to images and files,if I don't know where the page will be used?
with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
I only use the TilesServlet.
any suggestion?
i've also try to define the url like "/css/mycss.css" but in local dosn't work.
thank a lot for any reply!

Similar Messages

  • Using JSF and tiles

    Hi Friends,
    I'm trying to combine JSF and tiles as follows:
    Template file:
    <f:subview id="content">
    <tiles:insert attribute="content" flush="false"/>
    </f:subview>
    content file:
    <tiles:insert definition="userSpecific">
    <tiles:put name="content" type="string" >
    <h:outputText value="aaaa"/>
    </tiles:put>
    </tiles:insert>
    I get the following error when loading the content file:
    2007-06-20 10:14:10,578 [http-8080-Processor23] ERROR org.apache.myfaces.shared_impl.taglib.UIComponentTagUtils - Component javax.faces.component.UIViewRoot is no ValueHolder, cannot set value.
    I tried putting the template content in a verbatim tag and then it works
    but the content page is not displayed in correct place in the template...
    Thanks a lot in advance!

    Are you dead set on using tiles? I can see tiles including JSF but JSF including tiles? Not sure if that will work.
    My suggestion is to use Trinidad. It has the concept of Regions which is very "tiles" like and you will be far more successful.

  • Issue in using JSF and tiles

    Hai,
    I am using JSF and tiles in my application along with richfaces 3.2 jar but the suggestion box does not work when i use incorporate tiles to the jsp page,Please help me out.Here is my code
    Content Page
    <%@ taglib prefix= "f" uri="http://java.sun.com/jsf/core"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"  %>
    <%@ taglib uri="http://java.sun.com/jsf/core"   prefix="f"  %>
    <%@ taglib uri="http://java.sun.com/jsf/html"   prefix="h"  %>
    <%@ taglib uri="http://jakarta.apache.org/tiles"  prefix="tiles"  %>
         <f:view >
             <link href="<%=request.getContextPath()%>\styles\Form.css" rel="stylesheet" type="text/css"/>
             <link href="<%=request.getContextPath()%>\styles\Menu.css" rel="stylesheet" type="text/css"/>
             <link href="<%=request.getContextPath()%>\styles\Header.css" rel="stylesheet" type="text/css"/>
             <title><h:outputText value="Brand"/></title>
             <h:form id="testForm">
                 <tiles:insert definition="test_create" flush="false"/>
             </h:form>
         </f:view>JSP
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <f:subview id="come">
    <body>
    <h:form>
    <h:outputText value="Provider:" styleClass="SubTitle" />
    <h:inputText value="#{testMBean.property}" size="25" id="dpiSuggest" styleClass="SubTitle">
        <a4j:support event="onkeyup" />
    </h:inputText>   
    <rich:suggestionbox for="dpiSuggest" suggestionAction="#{testMBean.suggest}" height="180" width="180" var="suggest">
    <h:column>
    <h:outputText value="#{suggest.countryName}" />
    </h:column>
    <h:column>
    <h:outputText value="#{suggest.countryCode}" />
    </h:column>
    </rich:suggestionbox>
    </h:form>
    </body>
    </f:subview>
    </html>
    *tiles.xml*
    <tiles-definitions>
        <definition name="header-menu-content" path="/layout/basicLayout.jsp">
            <put name="gridClass"           value="headerMenuContent"/>  
            <put name="headerClass"         value="HeaderBgcolor"/>
            <put name="menuColumnClass"     value="MenuBorder"/>
            <put name="contentColumnClass"  value="BodyBgColor"/>
        </definition>
        <definition name="home" extends="header-menu-content">
            <put name="header"  value="/common/header.jsp"/>
            <put name="menu"    value="/common/menu.jsp"/>
            <!--<put name="buttonBar" value="/common/buttonBar.jsp"/>-->
            <put name="content" value="/common/home.jsp"/>     
        </definition>
        <definition name="error" extends="header-menu-content">
            <put name="header"  value="/common/header.jsp"/>
            <put name="menu"    value="/common/menu.jsp"/>
            <!--<put name="buttonBar" value="/common/buttonBar.jsp"/>-->
            <put name="content" value="/common/error.jsp"/>     
        </definition>
            <definition  name="test_create" extends="header-menu-content">
                 <put name="header" value="/common/header.jsp" />
                 <put name="menu" value="/common/menu.jsp" />
                 <!-- <put name="buttonBar" value="/common/buttonBar.jsp"/>-->
                 <put name="content" value="/test.jsp" />
             </definition>
        <tiles-definitions>
    *web.xml*
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>welcome.jsp</welcome-file>
            </welcome-file-list>
             <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
      </context-param>
      <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>
    <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>
    <filter>
      <display-name>RichFaces Filter</display-name>
      <filter-name>richfaces</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>
    <filter-mapping>
      <filter-name>richfaces</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>INCLUDE</dispatcher>
      </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>2</load-on-startup>
       </servlet>
        </web-app>
    *facesconfig.xml*
    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config version="1.2"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
        <navigation-rule>
                <navigation-case> <!-- Displayes the screen to add data -->
                <from-outcome>test</from-outcome>
                <to-view-id>/testContent.jsp</to-view-id>
                <redirect/>
            </navigation-case>
        </navigation-rule>
        <managed-bean>
            <managed-bean-name>testMBean</managed-bean-name>
            <managed-bean-class>testMBean</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
      </faces-config>Edited by: SreeramIyer on May 29, 2008 4:50 AM

    Are you dead set on using tiles? I can see tiles including JSF but JSF including tiles? Not sure if that will work.
    My suggestion is to use Trinidad. It has the concept of Regions which is very "tiles" like and you will be far more successful.

  • Jsf and tiles via myfaces

    Greetings:
    Please either confirm and/or correct following proposed solution for Myfaces tiles.
    Issue: isert a tile definition and attribute in a pure jsf page.
    First passed solution: A hybrid of Jsp programming and Jsf. I was able to create a tile page layout in pure jsf except in the portal columns i used old fashion jsp programming to insert a list of portletDefinitions which is extracted from jsf ValueBinding of its managed beans.
    The problem with the above approach is that it works well only with html portlet fragments. When a portlet fragment has some jsf elements, the page rendering has conflict of simultaneous rendering between jsf and jsp. The portlet fragments are rendered in a woring place.
    Proposed solution: use <h:dataTable ...> to render the portletList and extract the item portletDefinition as following:
    <h:dataTable var="portlet"
    value="#{portalTabbedBean.selectedPane.serviceListL}" >
    <f:verbatim>
    <h:outputText
    value="<tiles:insert name=#{portlet.portletDefinition} flush='false' /> " />
    </f:verbatim>
    </h:dataTable>
    Note on the name of tiles:insert element, which i just extracted the definition as a jsp variable to make it work in the first hybrid solution:
    <tiles:insert name="<%=portletDefinition%>" flush="false" />
    Thanks
    BaTien
    DBGROUPS

    I reply this myself. Jsf and Jsp programming either via Jstl or while loop do not go together under current version.
    I solve the problem by using Jsp programming and insert the portlet tile fragment directly rather than though a portlet template with different tile content attribute. The portlet tile is created as <h:panelGrid ...> and observe the set rules to make Jsf and jsp working together. Hopefully Jsf and Jsp will be able to work together nicely in their next specifications.

  • About jsf and tiles

    Good days , the following exception is happening:
    javax.faces.FacesException
    at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:53)
    at de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
    at de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
    at de.mindmatters.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:226)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:406)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
    Caused by: java.lang.NullPointerException
    at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:168)
    at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
    at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
    at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
    ... 21 more
    my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" 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">
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>true</param-value>
    <description>
    Set this flag to true if you want the JSF
    Reference Implementation to verify that all of the application
    objects you have configured (components, converters,
    renderers, and validators) can be successfully created.
    Default value is false.
    Poner a false cuando se ponga en produccion.
    </description>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
    <description>
    Set this flag to true if you want the JSF
    Reference Implementation to validate the XML in your
    faces-config.xml resources against the DTD. Default
    value is false.
    Poner a false cuando se ponga en produccion.
    </description>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    <description>
    Indica donde queremos guardar el estado de la aplicacion.
    Poner a server cuando se ponga en produccion. antes probarlo!
    </description>
    </context-param>
    <context-param>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
    <description>
    Este parametro le dice a MyFaces si se va a permitir renderizar javascript.
    Default: "true"
    </description>
    </context-param>
    <context-param>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
    <description>
    si es verdadero, el renderizado html estara formateado, permitiendo que se pueda leer
    bien. En la fase de desarrollo, estara a true, cuando este en produccion, estara a false.
    </description>
    </context-param>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>
    index.jsp
    </welcome-file>
    </welcome-file-list>
    <!-- listener de spring-->
    <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Tiles configuration
    definition files and a listener need to be defined.
    the listener will initialize JspTilesViewHandlerImpl with tiles definitions.
    -->
    <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>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <filter>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    </filter>
    </web-app>
    tiles-defs.xml
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE tiles-definitions PUBLIC
    "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    <tiles-definitions>
    <definition name="Base" path="/paginas/plantillaBasica.jsp">
    <put name="titulo" value="Base" type="string"/>
    <put name="cabecera" value="/cabecera.jsp" type="page"/>
    <put name="cuerpo" value="base" type="page"/>
    <put name="pie" value="base" type="page"/>
    </definition>
    <definition name="/busquedaDosCajas.tiles" extends="Base">
    <put name="titulo" value="Busqueda con dos cajas" type="string"/>
    <put name="cuerpo" value="/paginas/cuerpoDosCajas.jsp" type="page"/>
    </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">
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config>
    <application>
    <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>
    </application>
    <!-- El mantenimiento del bean proxy se delega al contenedor de spring-->
    <application>
    <variable-resolver>
    org.springframework.web.jsf.DelegatingVariableResolver
    </variable-resolver>
    </application>
    <!-- el unico idioma permitido es el espa�ol.-->
    <application>
    <locale-config>
    <default-locale>es</default-locale>
    </locale-config>
    </application>
    <!--
    - navigation rules
    -->
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>succesNoJS</from-outcome>
    <to-view-id>/paginas/listado.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>
    </faces-config>
    index.jsp
    <%@ page session="false"%>
    <%
    response.sendRedirect("busquedaDosCajas.jsf");
    %>
    anybody could help me? i dont know whats happening
    regards a lot

    first make sure you are using Tiles stand-alone (in Struts Sandbox)
    add the follwoing servlet to your web.xml
    <servlet>
    <servlet-name>Tiles Servlet</servlet-name>
    <servlet-class>org.apache.tiles.servlet.TilesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    add the following context-param to your web.xml
    <context-param>
    <param-name>tiles-definitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>
    add the following to your faces-config.xml
    <view-handler>org.apache.shale.tiles.TilesViewHandler</view-handler>
    add the following dependency to your pom.xml
    <dependency>
    <groupId>org.apache.shale</groupId>
    <artifactId>shale-tiles</artifactId>
    <version>1.0.3</version>
    </dependency>
    that should be it.
    Khaled

  • JSF 1.2 and Tiles integration

    I have a web application using JSF 1.1 and Tiles that I am trying to upgrade to run using JSF 1.2.
    It is working as far as working out that it should use the tile, but then it all seems to fall over when trying to render.
    Does anyone know if it is possible to use Tiles with JSF 1.2?
    Steven

    Hi,
    I took the Shales TileViewHandler and replaced the renderView method with the one below. This is a copy of the method from the Sun RI except that it passes the tile (ComponentDefinition) along to the subsequent methods.
    Then when it gets down to executePageToBuildView the requestURI is obtained from the tile (tile.getPath()) rather than from the UIViewRoot (viewToExecute.getViewId()).
       public void renderView(FacesContext facesContext, UIViewRoot viewToRender)
                                            throws IOException, FacesException {
          String viewId = viewToRender.getViewId();
          String tileName = getTileName(viewId);
          ComponentDefinition tile = getTile(tileName);
          if (log.isDebugEnabled()) {
             String message = null;
             try {
                 message = bundle.getString("tiles.renderingView");
             } catch (MissingResourceException e) {
                 message = "Rendering view {0}, looking for tile {1}";
             synchronized(format) {
                format.applyPattern(message);
                message = format.format(new Object[] { viewId, tileName });
             log.debug(message);
          if (tile != null) {
             if (log.isDebugEnabled()) {
                String message = null;
                try {
                    message = bundle.getString("tiles.dispatchingToTile");
                } catch (MissingResourceException e) {
                    message = "Dispatching to tile {0}";
                synchronized(format) {
                   format.applyPattern(message);
                   message = format.format(new Object[] { tileName });
                log.debug(message);
             dispatchToTile(facesContext, viewToRender, tile);
          else {
             if (log.isDebugEnabled()) {
                String message = null;
                try {
                    message = bundle.getString("tiles.dispatchingToViewHandler");
                } catch (MissingResourceException e) {
                    message = "Dispatching {0} to the default view handler";
                synchronized(format) {
                   format.applyPattern(message);
                   message = format.format(new Object[] { viewId });
                log.debug(message);
             defaultViewHandler.renderView(facesContext, viewToRender);
       private void dispatchToTile(FacesContext facesContext, UIViewRoot viewToRender, ComponentDefinition tile) throws java.io.IOException
           ExternalContext externalContext = facesContext.getExternalContext();
           Object request = externalContext.getRequest();
          Object context = externalContext.getContext();
          TilesContext tilesContext = TilesContextFactory.getInstance(context, request);
          ComponentContext tileContext = ComponentContext.getContext(tilesContext);
          if (tileContext == null) {
             tileContext = new ComponentContext(tile.getAttributes());
             ComponentContext.setContext(tileContext, tilesContext);
          else
             tileContext.addMissing(tile.getAttributes());
          renderTile(facesContext, viewToRender, tile);
          // dispatch to the tile's layout
          //externalContext.dispatch(tile.getPath());
       private void renderTile(FacesContext context, UIViewRoot viewToRender, ComponentDefinition tile) throws IOException, FacesException
           // suppress rendering if "rendered" property on the component is
           // false
           if (!viewToRender.isRendered()) {
               return;
           ExternalContext extContext = context.getExternalContext();
           ServletRequest request = (ServletRequest) extContext.getRequest();
           ServletResponse response = (ServletResponse) extContext.getResponse();
           try {
               if (executePageToBuildView(context, viewToRender, tile)) {
                   response.flushBuffer();
                   //ApplicationAssociate.getInstance(extContext).responseRendered();
                   return;
           } catch (IOException e) {
               throw new FacesException(e);
           // set up the ResponseWriter
           RenderKitFactory renderFactory = (RenderKitFactory)
           FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
           RenderKit renderKit =
                   renderFactory.getRenderKit(context, viewToRender.getRenderKitId());       
           ResponseWriter oldWriter = context.getResponseWriter();
           initBuffSize(context);
           WriteBehindStringWriter strWriter =
                 new WriteBehindStringWriter(context, bufSize);
           ResponseWriter newWriter;
           if (null != oldWriter) {
               newWriter = oldWriter.cloneWithWriter(strWriter);
           } else {
               newWriter = renderKit.createResponseWriter(strWriter, null,
                       request.getCharacterEncoding());           
           context.setResponseWriter(newWriter);
           newWriter.startDocument();
           doRenderView(context, viewToRender);
           newWriter.endDocument();
           // replace markers in the body content and write it to response.
           ResponseWriter responseWriter;
           if (null != oldWriter) {
               responseWriter = oldWriter.cloneWithWriter(response.getWriter());
           } else {
               responseWriter = newWriter.cloneWithWriter(response.getWriter());
           context.setResponseWriter(responseWriter);
           strWriter.flushToWriter(responseWriter);
           if (null != oldWriter) {
               context.setResponseWriter(oldWriter);
           // write any AFTER_VIEW_CONTENT to the response
           writeAfterViewContent(extContext, response);
       private boolean executePageToBuildView(FacesContext context, UIViewRoot viewToExecute, ComponentDefinition tile)
       throws IOException {
           if (null == context) {
               String message = MessageUtils.getExceptionMessageString
                       (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context");
               throw new NullPointerException(message);
           if (null == viewToExecute) {
               String message = MessageUtils.getExceptionMessageString
                       (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "viewToExecute");
               throw new NullPointerException(message);
           String mapping = Util.getFacesMapping(context);
           String requestURI =
                 updateRequestURI(viewToExecute.getViewId(), mapping);
           String requestURI =
               updateRequestURI(tile.getPath(), mapping);
           if (mapping.equals(requestURI)) {
               // The request was to the FacesServlet only - no path info
               // on some containers this causes a recursion in the
               // RequestDispatcher and the request appears to hang.
               // If this is detected, return status 404
               HttpServletResponse response = (HttpServletResponse)
                     context.getExternalContext().getResponse();
               response.sendError(HttpServletResponse.SC_NOT_FOUND);
               return true;
           ExternalContext extContext = context.getExternalContext();
           // update the JSTL locale attribute in request scope so that JSTL
           // picks up the locale from viewRoot. This attribute must be updated
           // before the JSTL setBundle tag is called because that is when the
           // new LocalizationContext object is created based on the locale.
           // PENDING: this only works for servlet based requests
           if (extContext.getRequest()
           instanceof ServletRequest) {
               Config.set((ServletRequest)
               extContext.getRequest(),
                          Config.FMT_LOCALE, context.getViewRoot().getLocale());
           // save the original response
           Object originalResponse = extContext.getResponse();
           // replace the response with our wrapper
           ViewHandlerResponseWrapper wrapped =
                 new ViewHandlerResponseWrapper(
                       (HttpServletResponse)extContext.getResponse());
           extContext.setResponse(wrapped);
           // build the view by executing the page
           extContext.dispatch(requestURI);       
           // replace the original response
           extContext.setResponse(originalResponse);
           // Follow the JSTL 1.2 spec, section 7.4, 
           // on handling status codes on a forward
           if (wrapped.getStatus() < 200 || wrapped.getStatus() > 299) { 
               // flush the contents of the wrapper to the response
               // this is necessary as the user may be using a custom
               // error page - this content should be propagated
               wrapped.flushContentToWrappedResponse();
               return true;           
           // Put the AFTER_VIEW_CONTENT into request scope
           // temporarily
           if (wrapped.isBytes()) {
               extContext.getRequestMap().put(AFTER_VIEW_CONTENT,
                                              wrapped.getBytes());
           } else if (wrapped.isChars()) {
               extContext.getRequestMap().put(AFTER_VIEW_CONTENT,
                                              wrapped.getChars());
           return false;
       }You will also find you need to copy a few other methods from the Sun RI.
    There were a couple of calls to ApplicationAssociate.responseRendered() which I just commented out as well (because they are not visible). They stop people changing the StateManager or ViewHandler after responses have been rendered. Probably not a problem since I will have replaced the ViewHandler anyway.
    Steven

  • Tiles, jsf and css

    Hi,
    I use JSF with Tiles for the first time to built a web application.
    I have a problem with my stylesheet which I use for my layout and the other pieces of pages.
    When I start my application, the first page works and the look and feel uses the stylesheet. But when I call an other page, the stylesheet isn't apply. I know there is a problem with the context path ...
    For the moment, I declare my stylesheet like that :
    <link rel="stylesheet" href="/css/style.css" type="text/css">
    So, it works only the the first page.
    I tried like this, thanks to the struts html tags :
    <link rel="stylesheet" href="<html:rewrite page='/css/style.css'/>" type="text/css">
    but this time, i have an error :
    [ServletException in:/tiles/layout.jsp] org.apache.struts.taglib.html.MessagesTei'
    If someone has a solution ...
    thanks..

    Will you please explain to me how you are doing CSS layout? I am having a problem with JSF 1.1 RI as everything is in a <td>. I want to get rid of these and change the rendered markup to output <div>s unless I can alter the location of <td>s on the page. This sounds like it would break the table model, so I doubt this is possible.
    Thank you for any input,
    TacoEater

  • JSF with TILES and HTML-Code

    Hello!
    I have a pure JSP-project using tiles. Now I want to migrate to JSF and find some problems.
    When I use my existing layout and include the different JSPs I have no problem as long I have a single f:view in every jsp file is used. When I try to define f:view and a h:form including different files and in each file JSF componets where used I got a very bad result. Additiotal I have to say, that I try to keep my formatting with HTML tags existing.
    The effect is, that all JSF componets were rendered at the beginning of the jsp file and than be included into the layout.
    Have I use a special order of f:view, f:subview, h:form, ....
    Alternative I could make a complete reprogramming of the JSP's, not my favourit, but than I need the possibility to set single formats for each <td> in a table and this seems not to be possible with h:panelGrid.
    Havy anyone an idea?
    Thanks for your help!

    Read about facelets as a replacement for tiles in jsf.

  • Blank Page with JSF 1.1.01 RI and Tiles

    My web pages have been rendered without any problem using JSF 1.1 and Tiles with Weblogic 8.1 SP3. But it can't handle multiple forms within a page. So I upgraded JSF to version 1.1.01 RI. I only get blank pages since the upgrade.
    Does anybody have the same problem? Any help is appreciated.

    I have the same problem with Tomcat 5.5 and tried both 1.1.01 and 1.1.02. I used both JSF RI 1.0 and 1.1 with no problem on JSF with tiles, but because of the known bugs in 1.1 I had to use 1.1.01 or later which doesn't work nicely with tiles. Does anyone know how to fix this in Tomcat?

  • JSF event handling - JSF/struts/tiles

    Has somebody had any luck integrating these technologies
    and having events for JSF work?
    Gisella

    I just came back from the Thanksgiving holiday.
    I followed the IBM tutorial and got the stuff to
    work. But I have JSF events that work fine when
    they were used in a framework with JSF only. Once I put
    Struts and Tiles, the events were not caught all the time;
    only some times. I traced the code and maybe
    because of Tiles, the Render Response Phase from JSF did not take place.
    "Ordinary Guy", when you said that you had an action listener hooked to a command button, I assume you refer
    to a JSF action listener. Right?
    Gisella

  • Building a Simple JSF and Web Services App in JDeveloper 10.1.3 Preview

    Hi
    I was trying out this example of JSF and webservices at:
    http://www.oracle.com/technology/products/jdev/101/howtos/jsfws/index.html
    Has anyone tried it before? I'm getting the following error:
    calling http://216.200.21.157:9090/soap
    WARNING: Unable to connect to URL: http://216.200.21.157:9090/soap due to java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
    java.rmi.RemoteException: ; nested exception is:
         HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
         at com.minc.ws.stockquery.proxy.runtime.NetXmethodsServicesStockquoteStockQuoteBinding_Stub.getQuote(NetXmethodsServicesStockquoteStockQuoteBinding_Stub.java:96)
         at com.minc.ws.stockquery.proxy.NetXmethodsServicesStockquoteStockQuotePortClient.getQuote(NetXmethodsServicesStockquoteStockQuotePortClient.java:40)
         at com.minc.ws.stockquery.proxy.NetXmethodsServicesStockquoteStockQuotePortClient.main(NetXmethodsServicesStockquoteStockQuotePortClient.java:29)
    Caused by: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
         at oracle.j2ee.ws.client.http.HttpClientTransport.invokeImpl(HttpClientTransport.java:142)
         at oracle.j2ee.ws.client.http.HttpClientTransport.invoke(HttpClientTransport.java:118)
         at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:175)
         at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:112)
         at com.minc.ws.stockquery.proxy.runtime.NetXmethodsServicesStockquoteStockQuoteBinding_Stub.getQuote(NetXmethodsServicesStockquoteStockQuoteBinding_Stub.java:79)
         ... 2 more
    Any ideas?
    Thanks
    Alex

    I'm not using 10.1.3 preview. I was using 10.1.3.1 production. I just copied the title of the tutorial as my subject. sorry for the confusion!! :)
    I used the HTTP analyzer and this is what I got in the header:
    <HTML><HEAD><TITLE>TCP Packet Monitor Error</TITLE></HEAD><BODY>JDeveloper TCP Packet Monitor encountered an error retrieving<P><pre>POST http://216.200.21.157:9090/soap HTTP/1.1
    Host: 216.200.21.157:9090
    Proxy-Connection: Keep-Alive
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: Oracle HTTPClient Version 10h
    SOAPAction: "urn:xmethods-delayed-quotes#getQuote"
    Accept-Encoding: gzip, x-gzip, compress, x-compress
    Content-type: text/xml; charset=UTF-8
    Content-length: 680
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="urn:xmethods-delayed-quotes"><env:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1"/></env:Header><env:Body><ns0:getQuote env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><symbol xsi:type="xsd:string">orcl</symbol></ns0:getQuote></env:Body></env:Envelope></pre><P>The error was :<P><pre>IOException retrieving the response: java.net.ConnectException: Connection refused: connect</pre><P></HTML>
    It looks like I'm getting connection refused error... Hmmm.. wonder why?
    I'll download 10.1.3.2 and see if that helps..
    Thanks for looking into this!
    Alex

  • JSF And Struts Integration

    Can any body give some info on integration of JSF to existing struts application

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • Using JSF and JavaMail to send Automated Email

    Hi All,
    Can any one please suggest I can use JSF and JavaMail to send automated email messages i.e after a person has successfully completed a form , a message is sent to his/her email address confirming that he has succesfully registered or completed a form. I have succesfull implemeted the use of javamail for sending email meassages in a JSF web application but cant seem to figure out how i can achieve automated sending of emails in JSF. Please any ideas, tutorials or source code would be very much appreciated.
    Thanks.

    I don't understand your problem:
    You have already been able to send e-mails from a JSF webapplication, but you are not capable of sending e-mails from a JSF webapplication?!
    Automated sending of e-mails will be exactly the same as non-automated.

  • JSF and Struts - differences and integration goal.

    I am a newbie J2EE developer and I am not clear about main differences between JSF and Struts also I saw couple of articles describing integration between JSF and Struts. Could someone give me an explanation, what the main conceptual differences between those technologies and what's the goal of integration both of them?

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • JSP, JSF, and ADF

    I've just started playing around with this and was looking for samples/tutorials to help. Of the tutorials/samples I've seen, they appear to fall short of explaining an end-end example and stick mostly to JSF and the backing bean - usually displaying static data within a JSP and navigation. I'm a bit confused on how to call custom methods in my business services (application modules) and in turn use the view objects to fetch data from my database and display the results within a JSP using the JSF components.
    I realize the latest preview JDeveloper is without ADF but while I had time I was hoping to play around with ADF Faces to hit my development database. Guess I'm trying to make sense of how JSP, JSF, Business components, and my db connection all play together in order to set up a decent starting point for an app.

    You could use Jdeveloper 10G and play around with ADF Faces, look at the demos, and the sources behind them.
    There are a couple of papers on OTN like...
    Working with ADF Faces in JDev 10g:
    http://www.oracle.com/technology/products/jdev/howtos/10g/adfjsf/how-to-adf-faces-10gjdev.htm
    Roadmap for ADF Faces:
    http://www.oracle.com/technology/products/jdev/collateral/papers/9.0.5.0/adfuix_roadmap/adfuix_roadmap.html
    And many more... as I could find upon search...
    http://www.oracle.com/ultrasearch/wwws_otn/searchotn.jsp?p_Action=Search&p_Query=adf+faces
    The visual editing support for 'The ADF Model access through ADF Faces bindings' is under development (hence no tutorials), and will be available in future release (could be post 10G release).
    -Udupa

Maybe you are looking for