我正在根据选择标签的变化动态加载弹簧复选框标签。但它会产生如下错误:
2012-08-31 09:27:14.829 org.springframework.web.servlet.tags.RequestContextAwareTag doStartTag: Neither BindingResult nor plain target object for bean name 'stockList' available as request attribute
W 2012-08-31 09:27:14.831 /stocks
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'stockList' available as request attribute
C 2012-08-31 09:27:14.832 Uncaught exception from servlet
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'stockList' available as request attribute
在我的应用引擎服务器日志中。
我的代码如下
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script
src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript">
function loadStocks() {
var exchange = $("#stockExchange").val();
var a;
if (exchange = "BO") {
a = "<form:checkbox path='stockList' value='INFY' label='Infosys' />"
+ "<form:checkbox path='stockList' value='HINDALCO' label='HINDALCO' />"
+ "<form:checkbox path='stockList' value='TTM' label='Tata Motors' />";
} else if (exchange == "NS") {
a = "<form:checkbox path='stockList' value='INFY' label='Infosys' />";
}
$("#kit").html(a);
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="content">
<form:form method="POST" commandName="search">
<ul data-role="listview">
<li data-role="fieldcontain">
<div id="kit">
<form:select path="stockExchange" onchange="loadStocks()"
id="stockExchange">
<form:option value="">Select Stock Exchange</form:option>
<form:option value="BO">BSE</form:option>
<form:option value="NS">NSE</form:option>
</form:select>
</div>
</li>
<li data-role="fieldcontain"><label>Select Stocks</label>
<div id="kit">
<form:checkbox path="stockList" value="INFY" label="Infosys" />
<form:checkbox path="stockList" value="HINDALCO" label="HINDALCO" />
<form:checkbox path="stockList" value="TTM" label="Tata Motors" />
<form:checkbox path="stockList" label="RELIANCE IND."
value="RELIANCE" />
</div></li>
<li data-role="fieldcontain"><input type="submit"
value="Submit" /></li>
</ul>
</form:form>
</div>
<!-- /content -->
</div>
<!-- /page -->
</body>