Is your #{bean} request scoped?On Thu, Mar 6, 2008 at 4:17 AM, Paul van Rossem <[EMAIL PROTECTED]> wrote: > Why takes no rendering takes place during the render response phase > after clicking the listbox. Or is there a bug? > <h:selectOneListbox> does what I would expect, while > <tr:selectOneListbox> doesn't. > > I have the following simple jsf: > > <?xml version="1.0" encoding="UTF-8" ?> > <jsp:root version="2.0" > xmlns:jsp="http://java.sun.com/JSP/Page" > xmlns:f="http://java.sun.com/jsf/core" > xmlns:h="http://java.sun.com/jsf/html" > xmlns:tr="http://myfaces.apache.org/trinidad"> > <jsp:directive.page contentType="text/html; charset=utf-8"/> > <f:view> > <tr:document title="applying listbox values"> > <tr:outputText value="clicking item in listbox doesn't update > outputText below:"/> > <tr:form> > <tr:panelFormLayout> > <tr:selectOneListbox label="item list:" value="#{bean.item}" > size="4" > valueChangeListener="#{bean.itemSelected}" autoSubmit="true"> > <f:selectItems value="#{bean.items}"/> > </tr:selectOneListbox> > </tr:panelFormLayout> > <tr:outputText value="Selected: #{bean.item}"/> > </tr:form> > </tr:document> > </f:view> > </jsp:root> > > and the following in the bean: > > package nl.timeware.vrtsim.beans; > import java.util.*; > import javax.faces.event.ValueChangeEvent; > public class Bean > { > private Integer selectedItem = 1; > > public Integer getItem() > { System.out.println("getItem(): " + selectedItem); > return selectedItem; > } > > public void setItem(Integer id) > { System.out.println("setItem(" + id +")"); > selectedItem = id; > } > > public Map<String, Integer> getItems() > { System.out.println("getItem(): " + selectedItem); > Map<String, Integer> itemMap = new TreeMap<String, Integer>(); > itemMap.put("Item 1", 1); itemMap.put("Item 2", 2); > itemMap.put("Item 3", 3); > return itemMap; > } > > public void itemSelected(ValueChangeEvent event) > { System.out.println("itemSelected(" + event.getNewValue() +")"); > selectedItem = (Integer)event.getNewValue(); > } > } > > If I click on one of the items, the following happens: > > PhaseTracker.beforePhase(): RESTORE_VIEW 1 > PhaseTracker.afterPhase(): RESTORE_VIEW 1 > PhaseTracker.beforePhase(): RENDER_RESPONSE 6 > getItem(): 1 > getItem(): 1 > getItem(): 1 > PhaseTracker.afterPhase(): RENDER_RESPONSE 6 > -- this is where I click the second item in the list -- > PhaseTracker.beforePhase(): RESTORE_VIEW 1 > PhaseTracker.afterPhase(): RESTORE_VIEW 1 > PhaseTracker.beforePhase(): APPLY_REQUEST_VALUES 2 > PhaseTracker.afterPhase(): APPLY_REQUEST_VALUES 2 > PhaseTracker.beforePhase(): PROCESS_VALIDATIONS 3 > getItem(): 1 > getItem(): 1 > itemSelected(2) > PhaseTracker.afterPhase(): PROCESS_VALIDATIONS 3 > PhaseTracker.beforePhase(): UPDATE_MODEL_VALUES 4 > setItem(2) > PhaseTracker.afterPhase(): UPDATE_MODEL_VALUES 4 > PhaseTracker.beforePhase(): INVOKE_APPLICATION 5 > PhaseTracker.afterPhase(): INVOKE_APPLICATION 5 > PhaseTracker.beforePhase(): RENDER_RESPONSE 6 > -- why isn't getItem() called here to render the outputText ? -- <<<<< > PhaseTracker.afterPhase(): RENDER_RESPONSE 6 > > What suprises me is that during the 2nd RENDER_RESPONSE phase never the > current value of the list is retrieved (Bean.getItem() is never called) > to render the outputText, with the result that it retains its now > obsolete value. getItem() is called in other phases, but that's of > course before its value was changed. > > When I replace the <tr:selectOneListbox> by the <h:selectOneListbox> > things work as expected and the outputText is correctly updated. > Any suggestions what I should change or should I file a JIRA issue? I am > using trinidad with jsf-1.2_07-b03-FCS. > > Thanks for any help, Paul. >

