我根據中的更改動態加載spring複選框標記select標記。但它會產生如下錯誤:使用jQuery在jsp中動態加載spring複選框標記的錯誤
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>