Solved

jsf drop down field hard code values

Posted on 2014-02-12
2
1,084 Views
Last Modified: 2014-02-21
Hi,

I would like to create a sample JSF XHTML page with a drop down with dummy Yes, No, Alright as drop down fields. How do I do that. I do not need to go to any bean to fetch those values. I want everything in the JSF xhtml page. Please advise

 Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
2 Comments
 
LVL 19

Accepted Solution

by:
Ken Butters earned 500 total points
ID: 39864738
Here is an example:

http://www.mkyong.com/jsf2/jsf-2-dropdown-box-example/

In this example... you would just change from:
<f:selectItem itemValue="Cream Latte" itemLabel="Coffee3 - Cream Latte" />

to something like:

<f:selectItem itemValue="Yes" itemLabel="Yes" />
<f:selectItem itemValue="No" itemLabel="No" />
<f:selectItem itemValue="Alright" itemLabel="Alright" />
0
 
LVL 7

Author Comment

by:gudii9
ID: 39867696
//HTML output...
<select name="j_idt6:j_idt8" size="1">      
      <option value="Cream Latte">Coffee3 - Cream Latte</option>
      <option value="Extreme Mocha">Coffee3 - Extreme Mocha</option>
      <option value="Buena Vista">Coffee3 - Buena Vista</option>
</select>


I do not want to use any backing bean as given in the example, how to avoid backing bean.

what shall i replace 'j_idt6:j_idt8' with?

Can you please send the enitre xhtm.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now