Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 31
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I make a selection with h:selectOneMenu and redisplay the value in a h:outputText?

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 h:outputText. The rendered h:outputText 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,
    Bookmark Topic Watch Topic
  • New Topic