Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populating a dropdown list from db

Pritty GK
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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)
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic