Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3720608
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:16:24+00:00 2026-05-19T05:16:24+00:00

I want to create simple html select tags with some populated values(for now what

  • 0

I want to create simple html select tags with some populated values(for now what I type, later from database). Here is my controller :

@Controller
public class HomeController {

    @RequestMapping("/test")

    public String home(){
        return "index";
    }

    @ModelAttribute("items")
    public ArrayList<String> getList(){
        ArrayList<String> itemList = new ArrayList<String>();
        itemList.add("one");
        itemList.add("two");
        itemList.add("three");
        return itemList;
    }

}

In my index part here is HTML code that is relevant :

<div class="form-row">
   <label for="items">Items:</label>
   <span class="input"><form:select path="items" items="${items}" itemLabel="name" /></span>
</div>

This produces(this is rendered into html) :

<div class="form-row">

   <label for="items">Items:</label>

   <span class="input"><form:select path="items" items="[one, two, three]" itemLabel="name" /></span>

</div>

And I had something else in mind like this(what I expected to produce) :

<div class="form-row">

       <label for="items">Items:</label>

       <span class="input"><select name="name">
       <option>one</option>
       <option>two</option>
       <option>three</option>
       </select></span>

    </div>

I could alter my getList() method by adding <option> before and </option> before each item in arrayList, I’m sure there is a pretier way to do this that is why I’m asking here, please bare in mind that I’m only starting to learn spring MVC. thank you

QUESTION UPDATE :

When I edit this according to skaffman suggestion, added this :

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>

after

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

and it caused this exception :

org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/index.jsp at line 39

36:     Date of birth: <input type="text" size="10" />
37:     <div class="form-row">
38:    <label for="items">Items:</label>
39:    <span class="input"><form:select path="items" items="${items}" itemLabel="name" /></span>
40: </div>
41:   </fieldset>
42:  


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause

org.springframework.beans.NotReadablePropertyException: Invalid property 'name' of bean class [java.lang.String]: Bean property 'name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:702)
    org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:694)
    org.springframework.web.servlet.tags.form.OptionWriter.doRenderFromCollection(OptionWriter.java:210)
    org.springframework.web.servlet.tags.form.OptionWriter.renderFromCollection(OptionWriter.java:180)
    org.springframework.web.servlet.tags.form.OptionWriter.writeOptions(OptionWriter.java:133)
    org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:216)
    org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    org.apache.jsp.WEB_002dINF.views.index_jsp._jspx_meth_form_005fselect_005f0(index_jsp.java:206)
    org.apache.jsp.WEB_002dINF.views.index_jsp._jspService(index_jsp.java:109)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:16:25+00:00Added an answer on May 19, 2026 at 5:16 am

    This is your error:

    Invalid property ‘name’ of bean class [java.lang.String]: Bean property ‘name’ is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

    You’re getting this because you’ve told the tag to use the name property of each item in the list, when generating the <option> labels. But your list consists of Strings, which have no name property.

    Just remove that from the tag, and you’ll be fine, i.e.:

    <form:select path="items" items="${items}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a very simple HTML/AJAX based GUI for a Python program.
I want to create a simple http proxy server that does some very basic
I want to create a simple box with a header bar containing a title
I want to create a simple bit of JS code that creates an image
Let's say that you want to create a dead simple BlogEditor and, one of
I'm making a simple form to create polls, therefore I want the possibility to
I have an Sqlite database in which I want to select rows of which
here are the requirement from marketing people: 1. they want to be able to
I want to learn how to use Struts 2 and I created a simple
I have a simple GtkStatusBar created with glade,and want to add a simple message

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.