aspose file tools*
The moose likes JSF and the fly likes On a button click need to load a select one menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "On a button click need to load a select one menu" Watch "On a button click need to load a select one menu" New topic
Author

On a button click need to load a select one menu

Babu Raj K R
Greenhorn

Joined: Jul 17, 2008
Posts: 13
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

Joined: Feb 16, 2006
Posts: 128

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

Joined: Jul 17, 2008
Posts: 13
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: On a button click need to load a select one menu