0 Replies Latest reply on Mar 11, 2009 6:03 PM by Ryan Waggoner

    Actions not hitting methods (always)

    Ryan Waggoner Newbie

      Hi guys,
        I have just been getting into Seam and am pretty new. I am sorry in advance if my problem just comes from me not looking hard enough, but I think I have looked pretty hard, at least for what I know.

      So, I have my Setup province page...

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
           <ui:composition template="/layout/template.xhtml">
                <ui:define name="title">
                     Province Setup
                <ui:define name="content">
                     <h:form id="form">
                          <h:outputText styleClass="bfont" value="Province Setup" />
                          <!-- Country Drop down box -->
                          <h:panelGrid columns="2">
                               <h:outputText value="Country" />
                               <h:selectOneMenu value="#{provinceCountry}">
                                    <!-- Only country is Canada for now -->
                                    <f:selectItem itemValue="CAN" itemLabel="Select A Country"
                                         noSelectionLabel="Select Country" />
                                    <f:selectItem itemValue="CAN" itemLabel="Canada" />
                                    <a:support event="onchange"
                                         action="#{stateBean.getStatesByCountry}" reRender="showProvinces" />
                          <!--  Provinces Drop down box  -->
                          <s:div id="showProvinces">
                               <h:panelGrid columns="2">
                                    <h:outputText value="Province" />
                                    <h:selectOneMenu onkeydown="enterTab();" value="#{state}">
                                         <s:selectItems value="#{provinceList}" var="provinceString"
                                              noSelectionLabel="Select Province" />
                                         <a:support event="onchange" eventsQue="foo"
                                              reRender="provinceTaxRates" requestDelay="1000" />
                                         <s:convertEntity />
                          <!-- Tax Rate Box -->
                          <s:span id="provinceTaxRates">
                               <rich:dataTable value="#{state.taxItems}" var="stateTax"
                                    <f:facet name="header">Taxes</f:facet>
                                         <h:outputText value="Name: " />
                                         <h:inputText value="#{stateTax.siName}" />
                                         <h:outputText value="Tax Rate: " />
                                         <h:inputText value="#{stateTax.siTaxRate}" />
                                         <h:commandButton value="Remove Tax" action="#{stateBean.deleteTax}" />
                               <!--  New Tax Table -->
                               <s:div id="newTaxInput">
                                    <h:panelGrid columns="1">
                                              <f:facet name="header">
                                                   <h:outputText value="New Tax for #{state.siStateCode}" />
                                                   <h:outputText value="Name: " />
                                                   <h:inputText value="#{stateTax.siName}" />
                                                   <h:outputText value="Tax Rate: " />
                                                   <h:inputText value="#{stateTax.siTaxRate}" />
                                                   <a:commandButton value="Save Tax" eventsQue="foo"
                                                        reRender="provinceTaxRates" />

      And my stateBean class looks like...

      import java.util.List;
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import org.hibernate.Hibernate;
      import org.jboss.seam.annotations.Begin;
      import org.jboss.seam.annotations.Conversational;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.FlushModeType;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.annotations.datamodel.DataModelSelection;
      import com.savageservices.dobi.BaseBean;
      import com.savageservices.dobi.shared.entity.SiDepartment;
      import com.savageservices.dobi.shared.entity.SiState;
      import com.savageservices.dobi.shared.session.State;
      import com.savageservices.dobi.timeAndBilling.entity.SiStateTax;
      public class StateBean extends BaseBean implements State {
           @Out(required = false)
           @In(required = false)
           private SiState state;
           private List<SiState> stateList;
           private List<SiState> provinceList;
           @In(required = false)
           private SiStateTax stateTax;
           @In(required = false)
           SiDepartment department;
           @In(required = false)
           String provinceCountry;
           public void destroy() {
                state = null;
                stateList = null;
                department = null;
            * Loads all states in the United States and orders them by state code.
           @Begin(join = true, flushMode = FlushModeType.MANUAL)
           public void setup() {
                String sql = "FROM SiState where siCountry = 'USA' order by siStateCode";
                stateList = entityManager.createQuery(sql).getResultList();
                for (SiState state : stateList) {
                state = user.getCurrentDepartment().getState();
            * Method to return a list of provinces names based on the country passed in
           @Begin(flushMode = FlushModeType.MANUAL, join = true)
           public void getStatesByCountry() {
                if(provinceCountry == null)
                     provinceCountry = "CAN";
                // query to get all states that have a country that matches the
                // province.getCountry property
                String hql = "FROM SiState " + 
                "WHERE siCountry = '" + provinceCountry + "'";
                // Run the query and put the result in an SiState list to cast into
                // provinces later
                provinceList = entityManager.createQuery(hql).getResultList();
           @Begin(flushMode = FlushModeType.MANUAL, join = true)
           public void selectState() {
            * Method to delete a Tax from this state
           @Begin(flushMode = FlushModeType.MANUAL, join = true)
           public void deleteTax() {
                // Remove the taxItem from the state
                // Remove the state Tax from the DB
            * Method to add a Tax to this state
           @Begin(flushMode = FlushModeType.MANUAL, join = true)
           public void addTax() {
                // Add the new tax to the state's list of taxes
                // Set the stateTax state, to the current state
                // Save the stateTax

      The problem is, when I load information in the span: provinceTaxRates, and the RemoveTax button that is loaded with it is clicked, nothing happens (aside from the page being loaded.)

      After I hit the Add Tax button and stateBean.addTax() is called, my remove tax button begins to work.

      Is the reason obvious?