0 Replies Latest reply on Dec 22, 2010 1:17 AM by prasit sriket

    Problem for encodeing variable where have h:selectOneMenu before h:inputText

    prasit sriket Newbie
      Problem for encodeing variable where have h:selectOneMenu before h:inputText


      case when I have h:inputText before h:selectOneMenu
      -------------------------------------------------------------------------------------------
      <h:inputText value="#{test.name}" />
      <h:selectOneMenu>
           <f:selectItem itemValue="0"  itemLabel="Test" />
      </h:selectOneMenu>

      The result : html output encode test.name from "default text\">" to "default text&quot;&gt;" it not have problem
      <input type="text" name="form:j_id23" value="default text&quot;&gt;" />
      <select name="form:j_id24" size="1">
           <option value="0">xxx</option>
      </select>

      And case when I have  h:selectOneMenu before h:inputText
      -------------------------------------------------------------------------------------------
      <h:selectOneMenu>
           <f:selectItem itemValue="0"  itemLabel="Test" />
      </h:selectOneMenu>
      <h:inputText value="#{test.name}" />

      The result :  html output not encode test.name so it have problem to view in browser
      <select name="form:j_id23" size="1">     
           <option value="0">xxx</option>
      </select>
      <input type="text" name="form:j_id25" value="default text">" />

      ---- My bean ------
      @Name("test")
      @Scope(ScopeType.PAGE)
      public class TestAction implements Serializable {
           private static final long serialVersionUID = -5959750029531501465L;
           
           private String name = "default text\">";
           public void setName(String name) {
                this.name = name;
           }
           
           public String getName() {
                return name;
           }
      }

      I want to know .Cause of the problem. And how to solve the problem.
      Thank you very much