2 Replies Latest reply on Oct 14, 2007 5:16 AM by Pete Muir

    faces-config.xml is missing in booking example?

    Arbi Sookazian Master

      Seam 2.0.0.CR2

      I did a search and several of the other example projects have a faces-config.xml in the resources folder.

      Why is this? the booking example in 1.2.1.GA had a faces-config.xml.

      Also, I want to start using facestrace to trace JSF lifecycle info:

      http://facestrace.sourceforge.net/index.html

      anybody used this with the Seam booking example? I will need to add a faces-config.xml as follows, but it seems to be missing from the instructions to do this:

      <faces-config>
       <managed-bean>
       <managed-bean-name>traceData</managed-bean-name>
       <managed-bean-class>net.sf.facestrace.TraceData</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      
       <lifecycle>
       <phase-listener>net.sf.facestrace.phase.listener.RestoreViewPhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.ApplyRequestValuesPhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.ProcessValidationsPhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.UpdateModelValuesPhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.InvokeApplicationPhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.RenderResponsePhaseListener</phase-listener>
       <phase-listener>net.sf.facestrace.phase.listener.TraceResourcePhaseListener</phase-listener>
       </lifecycle>
      
       <component>
       <component-type>net.sf.facestrace.component.Trace</component-type>
       <component-class>net.sf.facestrace.component.Trace</component-class>
       </component>
      
      </faces-config>


        • 1. Re: faces-config.xml is missing in booking example?
          Arbi Sookazian Master

          Not sure if this facestrace-0.8.1.jar is compatible with Eclipse 3.2.2 and JBoss 4.2.1.GA and Seam 2.0.0.CR2 or not.... it states in the instructions to place the <ft:trace/> tag at the end of your JSF file.

          Trying to use facestrace with main.seam, when I navigate to main.seam, I get the following:

          XML Parsing Error: prefix not bound to a namespace
          Location: http://localhost:8080/seam-booking/main.seam?cid=6
          Line Number 42, Column 1:<ft:trace></ft:trace>


          main.xhtml:

          <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:a="http://richfaces.org/a4j"
           xmlns:ft="http://sourceforge.net/projects/facestrace"
           template="template.xhtml">
          
           <short-name>FacesTrace</short-name>
           <uri>http://sourceforge.net/projects/facestrace</uri>
          
          <!-- content -->
          <ui:define name="content">
          
          <div class="section">
          
           <span class="errors">
           <h:messages globalOnly="true"/>
           </span>
          
           <h1>Search Hotels</h1>
          
           <h:form id="searchCriteria">
           <fieldset>
           <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
           <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
           </h:inputText>
          
           <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" reRender="searchResults"/>
          
           <a:status>
           <f:facet name="start">
           <h:graphicImage value="/img/spinner.gif"/>
           </f:facet>
           </a:status>
           <br/>
           <h:outputLabel for="pageSize">Maximum results:</h:outputLabel>
           <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
           <f:selectItem itemLabel="5" itemValue="5"/>
           <f:selectItem itemLabel="10" itemValue="10"/>
           <f:selectItem itemLabel="20" itemValue="20"/>
           </h:selectOneMenu>
           </fieldset>
           </h:form>
          
          </div>
          
          <a:outputPanel id="searchResults">
           <div class="section">
           <h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
           <h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
           <h:column>
           <f:facet name="header">Name</f:facet>
           #{hot.name}
           </h:column>
           <h:column>
           <f:facet name="header">Address</f:facet>
           #{hot.address}
           </h:column>
           <h:column>
           <f:facet name="header">City, State</f:facet>
           #{hot.city}, #{hot.state}, #{hot.country}
           </h:column>
           <h:column>
           <f:facet name="header">Zip</f:facet>
           #{hot.zip}
           </h:column>
           <h:column>
           <f:facet name="header">Action</f:facet>
           <s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
           </h:column>
           </h:dataTable>
           <s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
           </div>
          </a:outputPanel>
          
          <div class="section">
           <h1>Current Hotel Bookings</h1>
          </div>
          <div class="section">
           <h:form id="bookings">
           <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
           <h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
           <h:column>
           <f:facet name="header">Name</f:facet>
           #{book.hotel.name}
           </h:column>
           <h:column>
           <f:facet name="header">Address</f:facet>
           #{book.hotel.address}
           </h:column>
           <h:column>
           <f:facet name="header">City, State</f:facet>
           #{book.hotel.city}, #{book.hotel.state}
           </h:column>
           <h:column>
           <f:facet name="header">Check in date</f:facet>
           <h:outputText value="#{book.checkinDate}"/>
           </h:column>
           <h:column>
           <f:facet name="header">Check out date</f:facet>
           <h:outputText value="#{book.checkoutDate}"/>
           </h:column>
           <h:column>
           <f:facet name="header">Confirmation number</f:facet>
           #{book.id}
           </h:column>
           <h:column>
           <f:facet name="header">Action</f:facet>
           <h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
           </h:column>
           </h:dataTable>
           </h:form>
          </div>
          
          </ui:define>
          
          <!-- sidebar -->
          <ui:define name="sidebar">
          
          <h1>State management in Seam</h1>
          <p>
           State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
           retrieves a list of hotels from the database and caches it in the session context. When you
           navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em>
           begins. The conversation is attached to a particular tab, in a particular browser window. You can
           navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
           Each window will execute in the context of a different conversation. The application keeps state
           associated with your hotel booking in the conversation context, which ensures that the concurrent
           conversations do not interfere with each other.
          </p>
          
          <p>
           <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
           How does the search page work?
           </a>
          </p>
          
          <ft:trace />
          
          </ui:define>
          
          </ui:composition>
          
          
          


          trace.tld (which is in the facestrace-0.8.1.jar, after I modified the taglib tag as follows):

          <?xml version="1.0" encoding="UTF-8"?>
          
          <taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
          
           <tlib-version>1.0</tlib-version>
           <short-name>FacesTrace</short-name>
           <uri>http://sourceforge.net/projects/facestrace</uri>
           <tag>
           <name>trace</name>
           <tag-class>net.sf.facestrace.component.TraceTag</tag-class>
           <body-content>JSP</body-content>
          
           <attribute>
           <name>id</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
           </attribute>
          
           <attribute>
           <name>rendered</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
           </attribute>
          
           <attribute>
           <name>binding</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
           </attribute>
          
           <attribute>
           <name>showTree</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
           </attribute>
          
           </tag>
          </taglib>


          • 2. Re: faces-config.xml is missing in booking example?
            Pete Muir Master

            You're using facelets, thats a jsp tld. faces-config.xml is an optional file - if you don't need to configure anything in it, you ca omit it, like in the booking example.