5 Replies Latest reply on Jun 28, 2007 12:23 PM by Todd Main

    InputText value being cached

    Todd Main Newbie

      I have an "edit" form with an "h:inputText" component whose value comes from a bean.

      If I change the input value, cancel the edit and load the edit page again, I'm still seeing the modified value.

      I confirmed that the actual object that is outjected has the correct value from the database. I even added an "outputText" component after the "inputText" component on the page, and the input field has the bogus (modified) value while the text from "outputText" has the correct value.

      This is maddening!!!

      I'm using Seam 1.2.1. Here are some snippets:

      <h:inputText id="name" value="#{rule.name}" />
      <h:outputText value="#{rule.name}" />
      


      @Name("editDocumentRule")
      @Stateful
      @Scope(ScopeType.CONVERSATION)
      public class EditDocumentRuleAction implements EditDocumentRule {
      
       @PersistenceContext
       EntityManager em;
      
       @In(required = false)
       @Out(scope = ScopeType.CONVERSATION)
       DocumentRule rule;
      
       @In(create = true)
       DocumentRuleManager documentRuleMgr;
      
       @RequestParameter(value = "id")
       private Integer ruleId;
      
       @Begin(join = false, flushMode=FlushModeType.MANUAL)
       public String edit() {
      
       setRule(documentRuleMgr.getDocumentRule(em, getRuleId()));
      
       return "/jsf/rules/EditDocumentRule.xhtml";
       }
      
       @End
       @Rollback
       public String cancel() {
       em.refresh(rule);
       rule.setDoneEditing(true);
       return "/jsf/rules/EditDocumentRule.xhtml";
       }
      
       @End
       public String save() {
       rule.setDoneEditing(true);
       em.merge(rule);
       em.flush();
       return "/jsf/rules/EditDocumentRule.xhtml";
       }
      


        • 1. Re: InputText value being cached
          Pete Muir Master

          This is most likely your browser remembering the value input - if the outputText is correct, then it isn't Seam/JSF.

          • 2. Re: InputText value being cached
            Todd Main Newbie

            I would normally agree, but it behaves the same way in Firefox and IE 6, and I changed the cache settings in IE, and added a nocache line to the code.

            Besides, it only "remembers" the value when I change it then cancel.

            To expand on the problem a little, if I click on two items in the source page to edit them, I get two independent conversations with two different values for the name. If I change one of them and save it, all is well.

            If instead I change one of them and cancel, that value will show up as the "name" input in any other edit window.

            • 3. Re: InputText value being cached
              keurvet keurvet Newbie

              What JSF framework do you use ? I ask the question because IceFaces has this bug in its bug list : http://jira.icefaces.org/browse/ICE-1343 . A hack is given there.

              • 4. Re: InputText value being cached
                Todd Main Newbie

                Ah, we're using IceFaces (1.6DR5). I had discounted that before because I have this problem with h:inputText as well as ice:inputText, but maybe IceFaces is still controlling the underlying model.

                I'll take a look at their hack.

                Thanks!

                • 5. Re: InputText value being cached
                  Todd Main Newbie

                  As a followup, I had trouble implementing their workaround (from the Jira bug).

                  I was cancelling from a popup window, trying to end the conversation, and reload the parent window.

                  For some reason, when I tried to do this from the action listener, my parent window would hang.

                  I got it working by implementing both a listener and an action for the cancel button. The listener executes the workaround (clearing the submitted values in the UIComponents), while the action ends the conversation and triggers the parent window to reload.