我在让 jsp 正确呈现时遇到问题。我的选择标签上的路径似乎是罪魁祸首,但我无法追踪,不知道为什么。
我收到错误消息:错误 500:java.lang.IllegalStateException:Bean 名称“命令”的 BindingResult 和普通目标对象都不能用作请求属性
我的代码是:
控制器.java
@Controller
@RequestMapping("view")
@SessionAttributes({"analyticFormBean"})
public class RolesAnalyticsController {
@RenderMapping
public String defaultRenderer(RenderRequest request, RenderResponse response, ModelMap map){
logger.entering(SOURCE_CLASS, "defaultRenderer");
request.setAttribute("reportList", getReportList());
logger.exiting(SOURCE_CLASS, "defaultRenderer", VIEW_JSP);
return VIEW_JSP;
}
查看.jsp
<form:form id="reportForm" method="POST" action="${submitReportQuery}">
<form:select path="query" id="reportSelection" onchange="javascript:checkForFields()">
<form:option value="NONE" label="--- Select ---"/>
<form:options items="${reportList}" />
</form:select>
<input type="submit" value="Submit" name="Submit" ><br>
<div class="fieldPlaceholder" id="fieldPlaceholder"></div>
Bean.java
public class AnalyticFormBean {
private int reportID;
private String query;
private String queryResult;
private String[] listOfQueries;