• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

On a button click need to load a select one menu

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic