aspose file tools*
The moose likes JSF and the fly likes Make selection with h:selectOneMenu and redisplay the value in a h:outputText? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Make selection with h:selectOneMenu and redisplay the value in a h:outputText?" Watch "Make selection with h:selectOneMenu and redisplay the value in a h:outputText?" New topic
Author

Make selection with h:selectOneMenu and redisplay the value in a h:outputText?

Todd Patrick
Ranch Hand

Joined: Jan 30, 2004
Posts: 31

How do I make a selection with h:selectOneMenu and redisplay the value in a hutputText?

I have the following two JSF components defined:



With a button at the bottom of the page defined as:



In an Application scope bean, the method defined for valueChangeListener is:

public void clientIDSelected(ValueChangeEvent event) {
PhaseId phaseId = event.getPhaseId();
String oldValue = (String) event.getOldValue();
String newValue = (String) event.getNewValue();
if (phaseId.equals(PhaseId.ANY_PHASE)) {
event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
event.queue();
} else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES)) {
if (newValue != null) {
this.currentTransStartDate = newValue;
}
}

FacesContext context = FacesContext.getCurrentInstance();
context.renderResponse();
}


The navigation rule is defined as:

<navigation-rule>
<from-view-id>/transactionbrowser.jsf</from-view-id>
<navigation-case>
<from-outcome>no results</from-outcome>
<to-view-id>/transactionbrowser.jsf</to-view-id>
</navigation-case>
</navigation-rule>


When I click my single h:commandButton, the selected value from the h:selectOneMenu is not displayed in the hutputText. The rendered hutputText is empty:


I'd appreciate any help on this, this should be simple, but I guess I am missing the point.

I do have Kito Mann's JavaServerFaces In Action book, which doesn't seem to have a clear solution either, still a great book though.

Thanks,


--Todd
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Make selection with h:selectOneMenu and redisplay the value in a h:outputText?