• 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

Dynamically visibility control in JSF using selectOneMenu

 
Ranch Hand
Posts: 33
1
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to implement a functionality which will control the visibility of three outputText. I'm using a selectOneMenu, which has three options. Each option will enable visibility of one outputText, and rest will be invisible.

I used the following code

<h:selectOneMenu id="search" styleClass="select-box" value="#{empMB.showHide}" required="true" requiredMessage="Please Select an Option" >
<f:selectItem itemLabel="-----Select----"/>
<f:selectItem itemLabel="By Name" itemValue="1"/>
<f:selectItem itemLabel="By Id" itemValue="2"/>
<f:selectItem itemLabel="By Phone No" itemValue="3"/>
</h:selectOneMenu>

<h:outputText rendered="#{empMB.showHide ==1 }" value="Hello 1"></h:outputText>
<h:outputText rendered="#{empMB.showHide ==2 }" value="Hello 2"></h:outputText>
<h:outputText rendered="#{empMB.showHide ==3 }" value="Hello 3"></h:outputText>


Initially all outputText s is invisible as rendered value is false, but when I select different options, their respective outputText s are not visible.

Can anyone help me with this?

Thanks & Regards,
Debajyoti Kundu
 
Debajyoti Kundu
Ranch Hand
Posts: 33
1
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the error.. It's working now
reply
    Bookmark Topic Watch Topic
  • New Topic