This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes populating a dropdown list from db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating a dropdown list from db" Watch "populating a dropdown list from db" New topic

populating a dropdown list from db

Pritty GK

Joined: Jun 01, 2007
Posts: 1
Hi All,
I am trying to pupulate a dropdown list with values from db is struts.

I have my getters and setters in my UserForm
private List usertype = null;

public List getUsertype() {
return usertype;
public void setUsertype(List usertype) {
this.usertype = usertype;

UserForm userForm = (UserForm) form;
ReferenceService refService = ReferenceService.getInstance();
List userType = null;
userType = refService.getListRef(Constants.USER_TYPE);

jsp page

<html:select property="usertype" name="userForm">
<html ptions collection="usertype" property="refCode" Property="refDesc" />

I am getting this error :
- Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: No getter method for property: "userType" of bean: "userForm"
at org.apache.struts.taglib.TagUtils.lookup(
at org.apache.struts.taglib.logic.IterateTag.doStartTag(
at org.apache.jsp.jsps.MaintUser_jsp._jspService(org.apache.jsp.jsps.MaintUser_jsp:266)
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$

really needing some help on this...
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137

Rename the variable "usertype" to "userType" . notice the change in case.

Also I am not sure if there is any attribute by the name Property for tag html ptions. There is an attibute called "property" but attribute "Property" may not work.(again, notice the change in case)

Paras Jain
SCJP 5.0
subject: populating a dropdown list from db
Similar Threads
Issue in Struts Dropdown(Need Help Ranchers)
Populating 'html:select' with values in Database
Struts: Exception creating bean of class
Resource element in Tomcat 5.5 -- help needed
My html:select is not working