JSF 1.2 with tiles

Hi
I am using JSF with tiles and am having issues with page navigation with using tiles. Can any body tell me what to write in faces-config.xml so that the required page opens in tile which i have defined for that page in the corresponding tiles-defs.xml.
Here is the detail of code i am using
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.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/faces-config.xml
</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</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.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</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>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
faces-config.xml
<faces-config>
<application>
<view-handler>
org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl
</view-handler>
</application>
<from-view-id>*</from-view-id>
<navigation-rule>
<navigation-case>
<form-outcome>register</form-outcome>
<to-view-id>/tiles/register.page</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
tiles-defs.xml
<tiles-definitions>
<definition name=".mainLayout" path="/tiles/main-layout.jsp">
<put name="title" value=""/>
<put name="header" value="/tiles/header.jsp"/>
<put name="search-menu" value="/tiles/search-menu.jsp"/>
<put name="body" value=""/>
<put name="footer" value="/tiles/footer.jsp"/>
</definition>
<definition name="register.page" extends=".mainLayout">
<put name="body" value="/tiles/register.jsp"/>
</definition>
</tiles-definitions>
from page where we call register rule
<h:commandLink action="register" value="Register"/>
it opens register.jsp as new page instead of opening it into tile.
Please helpmeout in knowing where I am wrong and let me know how to open next page in tile because welcome page is opening very well in tile but when I click for next page whose definition is defined in tiles-def.xml it doesnot open in tile
Thanks

Still strugling with jsf1.2+tiles

Similar Messages

  • Is in JSF (with Creator) a tehnologie similar with Tiles?

    Hy! I'm new and I want to ask: is in JSF a tehnologie similar with Tiles? How can I make my jsf pages to have some header and footer? Of course, in Creator.
    Thank you very much.

    In general, by design, JSF is a much more flexible framework as JSF is built with integration and extensibility in mind. JSF isn't easier than Struts when developing by hand, but using Sun Java Studio Creator can make it much much easier and greatly increase your productivity.
    Take a look at the Craig McClanahan's Weblog (He was the original creator of the Struts Framework, and was the co-specification lead for JavaServer Faces (JSF) 1.0 )
    http://blogs.sun.com/roller/page/craigmcc/20040927#struts_or_jsf_struts_and
    A good place to learn more about JSF is JSF Central .
    http://jsfcentral.com/
    As for your second question, you could use 'Page Fragment Box'. Check the online help for "Page Fragment Box".
    'This component enables you to include a page fragment in a page. A page fragment is a separate, reusable part of a page that can be included in any number of pages. For example, you might want to put a common a visual element like a header graphic in a page fragment and then include it in all the pages in an application......'
    Hope that helps.

  • 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

  • Integrating ADF with Tiles - Facing some problem with ViewHandler

    Hi,
    I am trying to integrate ADF with Tiles. I am able to use tiles and display one or more JSF files using ADF components on a single tile using this thread, ADF Faces Access Denied But the issue is, the functionality of the pages are not getting included, for example, I have an action on click of a command link in one of the tiles, which is not working, its not even refreshing the page. When I tried using plain jsp:include, it works.
    I doubt its b'coz of Tiles - committing the response and forwarding the page, rather than including the page. Does anybody tried on this and have some work around?
    -Manju

    The example for AJAX and JSP with database is
    http://jspcodes.elementfx.com/forums/viewquestion.php?question=11&category=7&name=AJAX
    It works for me. Plz correct the + operator

  • Shale with Tiles

    Hello,
    can someone help me to sort it out. I'm trying to get tiles working with shale.
    I've shale-blank (their example 1.0.4 version) working fine under tomcat 5.5, also I have tiles-test (example 2.0.3 version) working fine.
    Now I'm building on the top of shale-blank.
    In WEB.XML I added :
    <context-param>
    <param-name>definitions-config</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>
    <listener>
    <listener-class>
    org.apache.tiles.listener.TilesListener
    </listener-class>
    </listener>
    In FACES-CONFIG.xmlI added:
    <application>
    <view-handler>
    org.apache.shale.tiles.TilesViewHandler
    </view-handler>
    </application>
    In WEB-INF\lib I added:
    shale-tiles-1.0.4, tiles-core-2.0-r468346-SNAPSHOT
    Since I'm reading that shale needs tiles 2, I copied into welcome.jsp (right from tiles 2.0.3 example):
    <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
    and places into tiles.xml reference to tiles-config_2_0.dtd
    Got exception:
    javax.faces.FacesException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application
         org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
         org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.shale.view.faces.ViewViewHandler.renderView(ViewViewHandler.java:147)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
         org.apache.shale.application.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:267)
         org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:703)
         org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:47)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.shale.application.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:267)
    I tried then to change to struts tiles:
    (1)<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%>
    (2) changing reference in tiles.xml to ...struts/dtds/tiles-config.dtd
    (3) and adding struts.jar to WEB-INF\lib.
    This time I've got:
    43: </p>
    44: <div id="level2">
    45: <f:subview id="content">
    46: <tiles:insert attribute="welc2" flush="false"/>
    47: </f:subview>
    48: </div>
    49:
    Stacktrace:
         org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
         org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.shale.view.faces.ViewViewHandler.renderView(ViewViewHandler.java:147)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
         org.apache.shale.application.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:267)
         org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:703)
         org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:47)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.shale.application.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:267
    Here is my WELCOME.jsp:
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%//@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%>
    <f:view>
    <%@include file="messages.jspf"%>
    <html>
    <head>
    <title><h:outputText value="#{messages['welcome.title']}"/></title>
    <head>
    <body>
    <p>
    <h:outputText value="#{messages['welcome.prompt']}"/>
    <h:outputText value="#{welcome.timestamp}">
    <f:convertDateTime type="both"/>
    </h:outputText>
    </p>
    <div id="level2">
    <f:subview id="content">
    <tiles:insert attribute="welc2" flush="false"/>
    </f:subview>
    </div>
    </body>
    </html>
    </f:view>

    Hi,
    Got exception:
    javax.faces.FacesException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this applicationTo solve above error u need to include tiles-jsp.jar in your project dependency. If you are using maven, you can give dependency in following way.
    <dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-jsp</artifactId>
    <version>2.0.5</version>
    </dependency>

  • JSF 1.2 + Shale Tiles

    Hi,
    I'm developing webapp with JSF 1.2 and Tiles. I think that I made everythig corect but when I'm running tha app I get following error:
    java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@67ec28 not expected type. Expected: javax.faces.component.UICommand. Perhaps you're missing a tag?
         com.sun.faces.taglib.html_basic.CommandLinkTag.setProperties(CommandLinkTag.java:259)
         javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:604)
         javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1111)
         com.sun.faces.taglib.html_basic.CommandLinkTag.doStartTag(CommandLinkTag.java:364)
         org.apache.jsp.common.welcome_jsp._jspx_meth_h_005fcommandLink_005f0(welcome_jsp.java:124)
         org.apache.jsp.common.welcome_jsp._jspService(welcome_jsp.java:70)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:413)
         com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:410)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:112)
         org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:176)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:243)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    Can somebody help? Thx.

    This is my layout:
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
         <head>
              <title>Music Store</title>
         </head>
    <f:view>
         <body>
              <table border="1" width="100%" cellspacing="5" height="100%">
                   <tr>
                        <td colspan="3" width="100%">
                        <f:subview id="header">
                             <tiles:insert attribute="header" flush="false"/>
                             </f:subview>
                        </td>
                   </tr>
                   <tr>
                        <td colspan="3" width="100%">
                        <f:subview id="menu">
                             <tiles:insert attribute="menu" flush="false"/>
                             </f:subview>
                        </td>
                   </tr>
                   <tr>
                        <td width="20%" valign="top" align="center">
                             <tiles:insert attribute="search" flush="false"/>
                        </td>
                        <td width="*" align="center" valign="top">
                        <f:subview id="body">
                             <tiles:insert attribute="body" flush="false"/>
                             </f:subview>
                        </td>
                        <td width="20%" valign="top" align="center">
                             <tiles:insert attribute="special" flush="false"/>
                        </td>
                   </tr>
                   <tr>     
                        <td colspan="3" width="100%">
                             <tiles:insert attribute="footer" flush="false"/>
                        </td>
                   </tr>
              </table>
         </body>
         </f:view>
    </html>
    This is tiles-defs:
    <?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="layoutLanguage" path="/common/layout.jsp">
              <put name="header" value="" />
              <put name="menu" value="" />
              <put name="special" value="" />
              <put name="search" value="" />
              <put name="footer" value="" />
         </definition>
         <definition name="layout" path="/common/layout.jsp">
              <put name="header" value="" />
              <put name="menu" value="/common/menu.jsp" />
              <put name="special" value="" />
              <put name="search" value="" />
              <put name="footer" value="" />
         </definition>
         <definition name="/common/welcome.tiles" extends="layout">
              <put name="body" value="/common/welcome.jsp" />
         </definition>
              <definition name="/pages/createAccount.tiles" extends="layout">
              <put name="body" value="/pages/createAccount.jsp" />
         </definition>
    </tiles-definitions>
    This is web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
         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>javax.faces.CONFIG_FILES</param-name>
              <param-value>/WEB-INF/faces-config.xml</param-value>
         </context-param>
         <!-- Tiles ViewHandler config file -->
         <context-param>
              <param-name>tiles-definitions</param-name>
              <param-value>/WEB-INF/tiles-defs.xml</param-value>
         </context-param>
         <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>0</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.faces</url-pattern>
         </servlet-mapping>
    </web-app>
    This is faces-config:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
         <application>
              <view-handler>
                   org.apache.shale.tiles.TilesViewHandler
              </view-handler>
         </application>
         <navigation-rule>
              <from-view-id>*</from-view-id>
              <navigation-case>
                   <from-outcome>createAccount</from-outcome>
                   <to-view-id>/pages/createAccount.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
         <managed-bean>
              <managed-bean-name>LocaleBean</managed-bean-name>
              <managed-bean-class>
                   com.MusicStore.managedBeans.LocaleBean
              </managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
         </managed-bean>
         <managed-bean>
              <managed-bean-name>CreateAccountBean</managed-bean-name>
              <managed-bean-class>
                   com.MusicStore.managedBeans.CreateAccountBean
              </managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
         </managed-bean>
    </faces-config>
    When I include f:view or f:subview in welcome.jsp the page appears but withput tiles. Maybe my layout is wrog. I was using this kind of layout durng myfaces development.

  • How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM.

    How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM. I found that it can be
    done by using XsltListViewWebPart class but how can I use this one by using shraepoint client api.
    shiv

    Nice, can you point me to the solution please ?
    I'm  trying to do this but I get an error : 
    Web Part Error: Cannot complete this action. Please try again. Correlation ID: blablabla
    StackTrace:    at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)     at Microsoft.SharePoint.SPList.GetView(Guid viewGuid)   
    All help really appreciated.

  • JSF 1.2 with SERVLET 2.3

    Hi, i've download the latest JSF 1.2 RI but i can't see any page as i get the following error:
    ava.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getContentType()Ljava/lang/String;
    at com.sun.faces.context.ExternalContextImpl.getResponseContentType(ExternalContextImpl.java:277)
    at com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:167)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:131)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    The getContentType method that the exception describes is only available in servlet 2.4 but i'm using a servlet 2.3 only container. Can i use JSF 1.2 with servlet 2.3 ?
    Thanks

    I'm 90% sure that you cannot. JSF 1.2 is intended to be part of Java EE 5.0. Since Servlets 2.3 are part of J2EE 1.3, I don't think that it will work.
    Adam

  • JSF table component with paging

    Are you aware of any existing JSF table component with both navigation and paging ?
    I want to display the content of a database table with a large number of rows. The table component should be able to navigate through the entire table content, but building only a small ResultSet and dinamically populate it with data as we perform navigation.
    Thanks,
    Cosmin

    Thanks for the answer.
    But data scroller just takes a ResultSet and display it with navigation. It doesn't know about the total number of rows in the table. It only display the number of records in the ResultSet.
    What I am looking for is a data scroller which based on some input parameters knows how to split the table in several ResultSets, dinamically change the ResultSet and display the total number of rows in the table and not in the current ResultSet.

  • JSF 1.2 with WAS 6.1

    Our current environment
    WAS 6.1.0.9 and using jsf 1.1
    Is it possible to upgrade to JSF 1.2 with upgrading to WAS 7 ?
    Thanks

    WAS7 already ships with JSF 1.2. JSF 1.2 is supposed to be backwards compatible with JSF 1.1 without any pains. Only keep in mind that any fixed bugs in JSF 1.2 may cause your application to behave different as opposed to JSF 1.1, especially when the application is developed so that it -either awarely or unawarely- relies on the presence of those bugs.

  • Source code of JSF implementation bundled with JDeveloper

    Where can I get the sources of JSF implementation bundled with JDeveloper 10.1.3.1 (1.1_02-b08)?

    Fair enough. Yes, as far as I know those implementation classes aren't available. Contacting Sun's consulting services is one option, of course. Make sure you get someone who has actual experience with the classes in question, rather than just anyone who happens to be on the bench right now, 'cos they'll charge you handsomely either way.
    I take it you've considered decompiling the classes in question ? Obviously there are legal issues to consider if you go that route, but I've found the Kaffe tool handy before now.
    http://www.kaffe.org/
    The only other thing I can think of is taking a dig around the IBM site to see if any of their equivalent classes are available in source form. I've always used the Sun versions, however, so I've no idea how likely this is.
    Ok, I'm out of ideas. Will be interested to hear if you come up with something even more devious.
    D.

  • JSF Actions and ActionListeners with Tiles and forms

    I�m having a problem trying to use the Tiles functionality in Struts 1.1 with JSF and was wondering if anyone could help me.
    I have defined a very simple header, menu, content Tile that doesn�t involve nesting of tiles (ExampleTile_content1Level.jsp).
    I have 3 JSP pages, the first testHarness.jsp is NOT built using Tiles and is just used to load some test data into a session scoped bean using an actionListener and then forward to a Tile generated page (ExampleTile3.jsp) using a hard-coded action �applicationSummary� when a commandLink is pressed. This works fine for both the action and actionListener.
    ExampleTile3.jsp contains another commandLink that is meant to forward to another tile ExampleTile2.jsp. This also works until I try to add the <h:form> � </h:form> tag around the outside of the <h:panelGrid> tags in ExampleContent1.jsp when the action and actionListener then fail to fire and I get an �Error on Page� message in Explorer the detail of which says �Error �com_sun_rave_web_ui_appbase_renderer_CommandLinkRendererer� is null or not an object�.
    However I need a form so that I can bind UI controls to data from the bean stored in the session scope. This is only a problem when I use Tiles to define the pages. Does anyone know what I am doing wrong?
    Any help would be much appreciated.
    Tiles.xml
       <definition name="example3" path="/pages/exampleTile_content1Level.jsp" >
              <put name="headerClass" value="someStyle"/>
              <put name="menuClass" value="someStyle"/>
              <put name="contentClass" value="someStyle"/>
              <put name="header-title" value="/pages/exampleHeader.jsp" />
              <put name="menu" value="/pages/exampleMenu.jsp" />
              <put name="content" value="/pages/exampleContent1.jsp" />
       </definition>
       <definition name="example2" path="/pages/exampleTile_content1Level.jsp" >
              <put name="headerClass" value="someStyle"/>
              <put name="menuClass" value="someStyle"/>
              <put name="contentClass" value="someStyle"/>
              <put name="header" value="/pages/exampleHeader.jsp" />
              <put name="menu" value="/pages/exampleHeader.jsp" />
              <put name="content" value="/pages/exampleContent2.jsp" />
       </definition>ExampleTile3.jsp
    <f:view>
         <h:form>
              <tiles:insert definition="example3" flush="false" />
         </h:form>
    </f:view> ExampleTile2.jsp
    <f:view>
         <h:form>
              <tiles:insert definition="example2" flush="false" />
         </h:form>
    </f:view> Faces-config.xml
    <navigation-rule>
        <from-view-id>/pages/testHarness.jsp</from-view-id>
           <navigation-case>
                <from-outcome>applicationSummary</from-outcome>
                <to-view-id>/pages/exampleTile3.jsp</to-view-id>
              <redirect/>
           </navigation-case>
    </navigation-rule>
    <navigation-rule>
        <from-view-id>/pages/exampleTile3.jsp</from-view-id>
           <navigation-case>
                <from-outcome>nextPage</from-outcome>
                <to-view-id>/pages/exampleTile2.jsp</to-view-id>
                <redirect/>
           </navigation-case>
    </navigation-rule> ExampleTile_content1Level.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" >
         <f:subview id="header-title">
              <tiles:insert name="header-title" flush="false" />
         </f:subview>
         <f:subview id="menu">
              <tiles:insert name="menu" flush="false" />
         </f:subview>
         <f:subview id="content">
              <tiles:insert name="content" flush="false" />
         </f:subview>
    </h:panelGrid> ExampleHeader.jsp / ExampleMenu.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" columnClasses="someSyle">
         <h:outputFormat value="This is the {0}.">
              <f:param value="Header / Menu as appropriate "/>         
         </h:outputFormat>
    </h:panelGrid> ExampleContent1.jsp
    <tiles:importAttribute scope="request"/>
    <h:form>     <----- Fails with this tag included but works without it.
    <h:panelGrid columns="1" >
              <h:outputFormat value="This is the {0}.">
                   <f:param value="Content on the FIRST page"/>
              </h:outputFormat>
              <h:commandLink action="nextPage" immediate="false">
                   <h:outputText value="Click to go to next page"/>
              </h:commandLink>
    </h:panelGrid>
    </h:form> ExampleContent2.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" >
         <h:outputFormat value="This is the {0}.">
              <f:param value="Content on the SECOND page"/>
         </h:outputFormat>
    </h:panelGrid>

    jezzica85 wrote:
    Hi everybody,
    I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
    method( action, action )
    method( action, listener )
    method( listener, action )
    method( listener, listener )
    Well, if you want to support that then you are just going to have to do suffer through it, the only shortcut I can recommend is that your method(action, listener) and method(listener, action) are the same so you only have to implement 1 and just use the other as a entry point to call the one you wish to contain the code.

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

  • JSF vs Struts - both with tiles

    I'm running in the problem migrating from Struts to JSF.
    In struts I have the following fragments:
    jsp (actualy in the resulting html):
    log4j
    struts-config:
    <forward name="log4j-page" path="doc.log4j"/>
    tiles-config:
    <definition name="doc.log4j" extends="doc.mainLayout">
    <put name="body" value="/WEB-INF/html/examples/log4j.jsp" />
    </definition>
    As a result this links the anchor on jsp page to my 'mainLayout' with 'body' replaced with ...log4j.jsp.
    I found no way to replicate this link in JSF.
    I tried <h:commandLink...> with a certain action. It seems that in faces-config fragment: <to-view-id>foo</to-view-id> JSF framework is always looking for foo.jsp.
    I'm wondering if there is any way of pointing in the faces-config to the definition name in tiles-config.

    Hello,
    There are differences between the two and some similarity. A couple of major differences I have noticed is that in using JSF you have much better control over user events and page response to user actions. The reason why is because JSF uses an event-driven model (e.g., you can write ActionListeners, EventHandlers, and event Dispatchers) to respond to any user activity on the page. Also JSF tags are far more programmer-friendly (in my opinion) than Struts. Another thing I would keep in mind (especially if you are a programmer) is that Craig Mc C. was the developer of both (with help from others); How often have you said to yourself after completing a project "given what I know now, If I started over from scratch I would make it so much better by doing... instead of ..."? Having used Struts for both large and small projects in the past, I really see JSF as a "simpler, leaner, smarter, more intuitive Struts than Struts". I think its much easier to learn and maintain than Struts (of course that depends on your coding style), and here is a key point: JSF will soon have visual drag and drop coding editors that both IBM and Sun will provide, and hopefully an open source version will appear as well. Visual design and development is not for everyone but it certainly has its place (in my opinion).
    I suggest you try create a simple app that includes all of the usual form components (checkboxes, lists, radiobuttons, textareas, submit buttons, etc. though not necessarily all on one page) using JSF and then Struts (or vise versa) then you can have a feel for how simple or complex it is using either for the usual web UI development assignment.
    Cheer,
    KamauObasi

  • JSF 2.0 and Tiles with Struts and Tomahawk libs.

    I have set up an example application that extends tiles. The issue I'm seeing is that although the tiles are all rendering, the ui: tags are not rendering as html, e.g. I see ui:html, ui:head, ui:form, etc.
    Has anyone else seen this, and how did you get around it?
    Thanks,
    w

    You could define an instance Y in the same scope as 'x' and then inject it into 'x' as a managed property. This is probably dead simple using annotations. It wouldn't be hard with the XML either, just verbose.
    If you really want it to be magical, you could create an implementation of javax.el.ELResolver that creates intermediate properties when you need them. Perhaps one already exists; perhaps the Stripes code has one.

Maybe you are looking for

  • Component video for 20" and 23"

    http://www.gefen.com/kvm/product.jsp?prod_id=3459 349 USD, pricey, does anyone know of any alternatives?

  • Unable to obtain inventory from some XP PC's

    I am unable to obtain version 7.5 inventory info from a handful of XP PC's. I believe it's something to do with this WifName registry entry which is blank on a PC where I cannot obtain inventory. I have uninstalled the 7.5 client, deleted the registr

  • Fullscreen slideshow to swipe.

    I need help in setting up slideshows. Got an Artikel with 3 pages and several pictures. When the user clicks on one picture, there should a full screen slideshow coming up. The user should be able to swipe through all pictures and choose the pictures

  • Changing Segment Name

    Hi all, what is the impact of changing a KFF segment name? thanks in advance,

  • Documentation on ELM required

    Hi, Please send the ELM Documentation. My Email Id is: [email protected] Points would be rewarded. Thanks n Regards, Kedar