You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Justin Mckay <ju...@famis.com> on 2008/07/01 20:24:33 UTC

[Trinidad] PPR related question

I have a page where I have a check box if it is unchecked  first name
appears as an inputtextfield if checked we ppr the page hiding the first
name and showing the last name as an inputtext field.  Below is a submit
button.  If I check the check box and enter a last name when I  submit and
get to the action in the backing bean the Boolean value is correctly set to
true but the last name is still null.  Here is the sample code:

 

public class CheckTest {

    private boolean check;

    private String firstName;

    private String lastName;

    

    public String save()

    {

      System.out.println(firstName);

      System.out.println(lastName);

    }

 

      /**

       * @return the check

       */

      public Boolean getCheck() {

            return check;

      }

      

      /**

       * @param check the check to set

       */

      public void setCheck(Boolean check) {

            this.check = check;

      }

 

      /**

       * @return the firstName

       */

      public String getFirstName() {

            return firstName;

      }

 

      /**

       * @param firstName the firstName to set

       */

      public void setFirstName(String firstName) {

            this.firstName = firstName;

      }

 

      /**

       * @return the lastName

       */

      public String getLastName() {

            return lastName;

      }

 

      /**

       * @param lastName the lastName to set

       */

      public void setLastName(String lastName) {

            this.lastName = lastName;

      }    

}

 

jsf code: 

 

<tr:panelFormLayout partialTriggers="test">

    <tr:selectBooleanCheckbox id="test" label="Test Me"
value="#{checkTestBean.check}" autoSubmit="true"/>

    <tr:inputText label="First Name" value="#{checkTestBean.firstName}"
readOnly="#{checkTestBean.check}" />

    <tr:inputText label="Last Name" value="#{checkTestBean.lastName}"
readOnly="#{not checkTestBean.check}" />

    <tr:commandButton text="Submit" action="#{checkTestBean.save}"/>

</tr:panelFormLayout>

 

If I take the same code and put the Boolean value in the process scope it
works as expected.  Do we have to use the process scope for a situation like
this or am I missing something?