jsf - How to get Trinidad tr:inputText to echo its changed value instantly? -
i have next trinidad tr:inputtext field in xhtml file bound "value1" in managed bean class; inputtext field of type:
org.apache.myfaces.trinidad.component.core.input.coreinputtext
<tr:inputtext value="#{mybean.value1}" autosubmit="true" immediate="true" valuechangelistener="#{mybean.textchangelistener}" styleclass="stylepagetextsmallcolored"> </tr:inputtext> <tr:commandbutton id="btncommit" inlinestyle="width:20" immediate="true" text="commit" action="#{mybean.docommit()}" styleclass="stylebutton"> </tr:commandbutton> public void textchangelistener(valuechangeevent e) { log.debug(">> textchangelistener: value=["+(string)e.getnewvalue()+"]"); } public string docommit() throws throwable { log.debug("in docommit: value1="+value1); value1 = "("+value1+")"; // update database modified value1 string here; database has right // updated value1 string (with parentheses). // how modified value1 (above) echo screen instantly // within docommit() method changes? }
when type field , alter value press "commit" button, can see value obtained screen in docommit() method , textchangelistener() method indicates has been called. create changes "value1" variable , echo value instantly screen without doing screen submit; can done part of docommit() method or through other mechanism/tag in xhtml file?
please note using trinidad , input text class listed above.
update...
thank reference jasper; want same inputtext field update after setter method called , input text changed (by setter method). reference page pointed to; tried next , works using partialtriggers attribute:
<tr:inputtext id="myvalue" value="#{mybean.value1}" autosubmit="true" immediate="true" partialtriggers="myvalue" valuechangelistener="#{mybean.textchangelistener}" styleclass="stylepagetextsmallcolored"> </tr:inputtext>
you can using trinidad's partial page rendering.
in short: need add together id
attribute input, , have , tr:outputtext
component partialtriggers
attribute refer input component.
minimal implementation in case be:
<tr:inputtext id="value1input" value="#{mybean.value1}" autosubmit="true" immediate="true"/> <tr:outputtext value="value1: #{mybean.value1}" partialtriggers="value1input"/>
jsf jsf-2 trinidad
No comments:
Post a Comment