Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSF and the fly likes Validation Error on SelectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Validation Error on SelectOneMenu" Watch "Validation Error on SelectOneMenu" New topic

Validation Error on SelectOneMenu

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455

Im getting validtion error on SelectOneMenu while submiting the page
this is my code

im developing a prototype, i was getting the error message only in selectonemenu. I tried setting the value with " value="#{sessionScope.selectOneValue}" but it is still throwing error.

this is the error message

com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=entryform:mainTabView:submitPage:uwReview,summary=Validation Error: Value is not valid)

Has anyone faced this issue ? Any help or suggestion on this is appretiated !

gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi ,

instead of giving the list values in jsp , you can create a list in your backing bean and you can call that list in your jsf.

it will solve your problem.

for eg:

in backing bean:

private String eventType;
private static SelectItem[] allEventTypes = new SelectItem[] {
new SelectItem("Select All"),
new SelectItem("first"),
new SelectItem("second")

public SelectItem[] getAllEventTypes(){
return allEventTypes;

public static void setAllEventTypes(SelectItem[] allEventTypes) {
BackingbeanName.allEventTypes = allEventTypes;

getter and setter for eventType also.
in JSP:
<h:selectOneMenu id ="eventType" value="#{formName.eventType}" required="true">
f:selectItems value="#{formName.allEventTypes}"/>

hope this will help.

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
Gopal, thanks for the reply and code. im still getting the same error message. I hav made some changes in the code you send me, because i dont want SelectItem[] to be declared static

i will copy my jsp and backing bean , please have a look at it and let me know if i am doing anything wrong.

the error message im getting is
com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=newRegularApp trixMainTabView:multipleBorrowerPage:borrowerTabViewId:borrowerPage:myselect,summary=Validation Error: Value is required.)

Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Can you post the code for pc_Borrower.emptyString? Is it a proper getter/setter property or you always return empty string for the property?

Just wonder if empty string is always returned, then it wouldn't pass the required=true validation check.

SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="" target="_blank" rel="nofollow"></a>
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455

this is how i declared the variable emptyString in the backingBean

Thanks for the reply!!

I agree. Here's the link:
subject: Validation Error on SelectOneMenu
It's not a secret anymore!