Skip to content

SelectTag fails when items is an Enumeration [SPR-7112] #11772

@spring-projects-issues

Description

@spring-projects-issues

Ed Belisle opened SPR-7112 and commented

Using an Enumeration class as items in a select tag throws an exception:

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Type [java.lang.Class] is not valid for option items
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    ...     

This is caused by a bug at Line 138 in class org.springframework.web.servlet.tags.form.OptionWriter:

Current line with error:

else if (this.optionSource instanceof Class && this.optionSource.getClass().isEnum()) { 

Suggested Correction:

else if (this.optionSource instanceof Class && ((Class)this.optionSource).isEnum()) { 

Affects: 3.0.2

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions