• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

On a button click need to load a select one menu

 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) i have a text field, a button and a select one menu
2) when i type some thing in the text field and click on the button, the details need to be loaded to a select one menu
3) How can it be achieved
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the following is maybe what you need.

a. set the action attribute of the button to a logical outcome name
b. set the value attribute of the text field to a bean property using a method expression like value="#{user.input}"
c. within the select one menu in the outcome web page, use the bean property to display the value like value="#{user.input}"
d. within faces-config.xml, add a navigation rule to map the above logical outcome name to actual web page
ex: <navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/welcome.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

This rule states that the success outcome navigates to /welcome.xhtml if it occured inside /index.xhtml. I think the <to-view-id> can be same as <from-view-id>, if your select-one menu is in the same page as the text-field. Initially, a blank may be displayed.
 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allen Sylvester wrote:the following is maybe what you need.

a. set the action attribute of the button to a logical outcome name
b. set the value attribute of the text field to a bean property using a method expression like value="#{user.input}"
c. within the select one menu in the outcome web page, use the bean property to display the value like value="#{user.input}"
d. within faces-config.xml, add a navigation rule to map the above logical outcome name to actual web page
ex: <navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/welcome.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

This rule states that the success outcome navigates to /welcome.xhtml if it occured inside /index.xhtml. I think the <to-view-id> can be same as <from-view-id>, if your select-one menu is in the same page as the text-field. Initially, a blank may be displayed.


Thanks a lot it worked

How can we achieve it using ajax... its actually a search operation,
1) inside the text we will enter some text then click on the search button
2) The details will be loaded into the select item
3) Can we achieved it using ajax .. so that the full page request can be avoided
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic