• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

selection to change JSF page immediately (without submit)

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there guys,

I'm confused about how the immediate=true option works as well as the valueChangeListener. They both seem to work when the page gets submitted. What I need to do is (preferably without scripting) the following.

<h:outputText value="Type" />
<h:selectOneMenu value="#{myBean.type}">
<f:selectItem itemValue="1" itemLabel="Once"/>
<f:selectItem itemValue="2" itemLabel="Weekly"/>
<f:selectItem itemValue="3" itemLabel="Monthly"/>
</h:selectOneMenu>

<h:panelGroup rendered="#{myBean.type == 1}">
<h:outputText value="You have selected ONCE"/>
</h:panelGroup>
<h:panelGroup rendered="#{myBean.type == 2}">
<h:outputText value="You have selected WEEKLY"/>
</h:panelGroup>
<h:panelGroup rendered="#{myBean.type == 3}">
<h:outputText value="You have selected MONTHLY"/>
</h:panelGroup>

Hopefully the above is all explanation necessary. I want the page to change as the user selects another option on the drop down box. I do not want to submit the page, because there is a whole bunch of other stuff on this same page that will fail validation if the page submits, also I would like to keep the rendered item a select box. Can anyone point me in the right direction here, or simple is scripting the only way to achieve this?

cheers
Darryl
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"immediate" is an option to short-circuit the normal flow on a JSF submit.

JSF pages are rendered as HTML, and HTML can only be modified after it's received by a client-side script. The core JSF package doesn't have any provision for client-side scripting.

Fortunately, there's more available than core JSF. What you're describing is done very easily using the RichFaces tag set. RichFaces was developed by Exadel, and is now part of the RedHat/JBoss set of J2EE resources.
reply
    Bookmark Topic Watch Topic
  • New Topic