Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run the MethodeBean & display the fields that corresponds to selectMenu

 
Yas El
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a page. Xhtml, which contains a list of choices (Oracle, Teradata), I want :

1 - If the user chooses Oracle will display the fields (host, port, user, password, basename) will fill it, and calls the method connect in class ManagedBeanO.

2 - If the user selects Teradata, there will be just the fields (host, user, password) to complete, and calls the method connect in class ManagedBeanT to connect.

Choix.xhtml
 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use rendered attribute of tag to display or hide.
 
Yas El
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bajrang asthana

How can I use use rendered attribute of tag to display or hide ???

Can you help me, or edit my code please ... because I'm beginner in this stuff

 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do like below-

1. Add value change listener with your h:selectOneMenu


Specify ManagedBeanMethod and store selected item of menu bar.

2. Specify rendered attribute like below




when you want to show this tags you need to return true value from ManagedBeanMethod like below-



 
Yas El
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I edit my choix.xhtml


Where can I put this ? :


And the ManagedBeanMethod : will be in ManagedBeanT or ManagedBeanO ?

?? How Can I know is the selecteItem is Oracle or Teradata ?


 
Yas El
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Someone help me please
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can use the 'rendered' attribute to either render or not render an element depending on a condition.

You could use a ManagedBean to represent the user's choice.









 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic