java - Store Previous SelectedValue from selectOneListbox -


i need quite simple solution implement this.

i need store value selected in jsf selectonelistbox drop down , need preserve value in bean. everytime when user selects new value, 1 value should checking new value in drop down. how best this using session? java solutions preserve previous selected value?

i tried valuechangeevent oldvalue not working because scope request , that's why looking alternate methods.

my jsf version 1.1

well, can try this:

<h:form>     <h:inputhidden id="oldvalue" value="#{mrbean.oldvalue}" />      <h:selectonelistbox id="newvalue" value="#{mrbean.newvalue}">         ...     <h:selectonelistbox>      <h:commandbutton actionlistener="#{mrbean.dosomething}" value="submit" /> </h:form> 

then can access old value way:

@requestscoped @managedbean public class mrbean {     private string oldvalue;     private string newvalue;      public void doseomthing() {        if (oldvalue != null) {            // whatever need when oldvalue not null here        } else {            // 1st request have oldvalue == null        }         oldvalue = newvalue; // update oldvalue newvalue     }      // getters , setters } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -