[jboss-user] [JBoss Seam] - Problems using Ajax4jsf to Seam Hibernate3 sample app

smartbinary do-not-reply at jboss.com
Thu Sep 28 14:49:05 EDT 2006


Hello,

I've recently worked to get the latest versions of Ajax4jsf, Seam, Hibernate-core, and Hibernate-Annotations running the Seam Hibernate3 Booking sample...persisting to an Oracle 10gR2 DB.  Everything is running fine until I try to add some Ajax4jsf functionality in.  I've noticed others posting Ajax4jsf w/Seam related questions here...so here's another :-)

Here's an example of what I'm running into: I'm working with the main.xhtml file and have replaced the standard jsf command buttons with the a4j:command buttons -- with a reRender to an a4j:outputPanel.

The system processes command button requests fine, but I always get a full-page redraw (instead of the desired redraw of the targeted a4j:outputPanel).  If I add a , it reports that the system is always doing an extra redirect after the post -- potentially leading to the full page redraw?

Here is the updated Seam booking main.xhtml page:

<!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:a4j="https://ajax4jsf.dev.java.net/ajax"
                template="template.xhtml">

<!-- content -->
<ui:define name="content">

  <h:form>
    <h:messages globalOnly="true"/>
    <h1>Search Hotels</h1>
     
        <h:inputText value="#{hotelBooking.searchString}" style="width: 165px;" /> 
		<a4j:commandButton value="Find Hotels" action="#{hotelBooking.find}" styleClass="button" reRender="hotelFrm"/> 
		<a4j:commandButton value="Clear Results" action="#{hotelBooking.clear}" styleClass="button" reRender="hotelFrm"/> 
    
  </h:form>


<a4j:outputPanel id="hotelFrm">

  <h:form>
    <h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
    <h:dataTable 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}
        </h:column> 
        <h:column>
            <f:facet name="header">Zip</f:facet>
            #{hot.zip}
        </h:column>
        <h:column>
            <f:facet name="header">Action</f:facet>
            <h:commandLink action="#{hotelBooking.selectHotel}">View Hotel</h:commandLink>
        </h:column>
    </h:dataTable>
  </h:form>



    <h1>Current Hotel Bookings</h1>


  <h:form>
    <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
    <h:dataTable 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}">
                <f:convertDateTime type="date"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">Check out date</f:facet>
            <h:outputText value="#{book.checkoutDate}">
                <f:convertDateTime type="date"/>
            </h:outputText>
        </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 action="#{bookingList.cancel}">Cancel</h:commandLink>
        </h:column>
    </h:dataTable>
  </h:form>

</a4j:outputPanel>
</ui:define>

<!-- sidebar -->
<ui:define name="sidebar">
</ui:define>

</ui:composition>


-----

Any advice is MUCH appreciated.


Regards,

Todd

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974988#3974988

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974988




More information about the jboss-user mailing list