File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes selectOneMenu from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "selectOneMenu from database" Watch "selectOneMenu from database" New topic

selectOneMenu from database

Ivann Ivanoff

Joined: Oct 09, 2006
Posts: 4
Hi All,
Why my code doesn't works? After code execution on JSP page I get empty selectOneMenu. Please help me!

Page: test1.jsp:


<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="" prefix="h" %>

<link href="styles.css" rel="stylesheet" type="text/css"/>

<h:form >

<h:selectOneMenu value="#{test1.value}">
<f:selectItems value="#{test1.values}" />




A. Dusi
Ranch Hand

Joined: Sep 27, 2004
Posts: 114
You probably are not seeing the menu labels on the page. Try this:
SelectItem(java.lang.Object value, java.lang.String label)
instead of this:
SelectItem(java.lang.Object value).
This will construct a SelectItem with the specified value and label.

Also from the code I could not figure out if you are calling the getNames() anywhere. Did you verify that this method gets called and the resultset is not empty?
[ October 31, 2007: Message edited by: A. Dusi ]
Ivann Ivanoff

Joined: Oct 09, 2006
Posts: 4
Thanks A. Dusi !

With pleasure would look at a similar working code, (code must work with database) !!!
Ivann Ivanoff

Joined: Oct 09, 2006
Posts: 4
Guys, I solved this broblem. My implementation isn't perfect, but he works!


I agree. Here's the link:
subject: selectOneMenu from database
It's not a secret anymore!