Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop down menu usinng optionCollections

 
Namrta Pandey
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have a List in my JSP which is coming from my hibernate query. It has only one column for example all the employee ids from the table. Now i want to show these emplyee ids in a drop down. I'm using optionCollections for the same but at runtime it is throwing an exception that no getter method for emp110(one of the emplyee code i.e. value in the list) under myForm bean has found.

Can anyone please tell me how can i show empids in drop down.

Thanks in Advance.

Namrta.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Namrta Pandey wrote: no getter method for emp110(one of the emplyee code i.e. value in the list) under myForm bean has found.

You, somewhere in your JSP code has written or set a property for "emp110" and the corresponding bean doesn't have a valid getter for that property !!

So check your JSP and the underlying bean for the required property !!

HTH
 
Namrta Pandey
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emp110 is just a value which is coming as a result of query and it can be anything, so i anyway can't set any setter and getters for these values.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I repeat my first sentence:
You, somewhere in your JSP code has written or set a property for "emp110" and the corresponding bean doesn't have a valid getter for that property !!


that means, find out where you mistakenly declare a property attribute as "emp110".
 
Namrta Pandey
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not declared any setter or getter method for "emp110".
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK,
1. Either you found out that in you JSP page, you somewhere assiging a dynamic value to "property" attrbute
like

2. OR post your JSP, we will find out where this thing goes wrong.
 
Namrta Pandey
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sagar , I have resolved the problem by fetching the whole record from database instead of fetching on empCode, son now its working fine.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I comment on this, because I didn't know how your code looks like,
Anyway, You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic