我以前做过这个,但这次不能让它工作:S
我有一个带有表单的JSP:
<form action="/SimModSystem-web/ExecuteModel" method="post">
<h2>Initial State</h2>
<h3>ASSET</h3>
<div style="style0"><span style="style1">Assets Amount</span><span style="style2"><span style="style2">Amount<input type="text" value="[-Infinite - +Infinite]" id="initial..asset.amount.param0" /></span></span></div>
<div style="style0"><span style="style1">Savings Interest APR</span><span style="style2"><span style="style2">APR %<input type="text" value="[0.0 - 1.0]" id="initial..asset.apr.param0" /></span></span></div>
<div style="style0"><span style="style1">Desired Savings Percentage</span><span style="style2"><span style="style2">Annual %<input type="text" value="[0.0 - 1.0]" id="initial..asset.minsaving.param0" /></span></span></div>
<h3>LIABILITY</h3>
<div style="style0"><span style="style1">Liabilities Monthly Minimum Payment Percentage</span><span style="style2"><span style="style2">Minimum Payment %<input type="text" value="[0.0 - 1.0]" id="initial..liabilities.minpay.param0" /></span></span></div>
<div style="style0"><span style="style1">Liabilities Amount</span><span style="style2"><span style="style2">Amount<input type="text" value="[0.0 - +Infinite]" id="initial..liabilities.amount.param0" /></span></span></div>
<div style="style0"><span style="style1">Liabilities APR</span><span style="style2"><span style="style2">APR %<input type="text" value="[0.0 - 1.0]" id="initial..liabilities.apr.param0" /></span></span></div>
<div style="style0"><span style="style1">Liabilities Delayed Payment Fee</span><span style="style2"><span style="style2">Fee Amount<input type="text" value="[0.0 - +Infinite]" id="initial..liabilities.delayedfee.param0" /></span></span></div>
...
<input type="submit"/>
</form>
当我尝试这样做时,点击&#34;提交&#34;,在servlet中:
request.getParameterNames();
request.getParameterMap();
request.getParateter("initial..liabilities.delayedfee.param0"); //or any other param
全部返回&#39; null&#39;。
正如您所看到的,此表单中没有特殊编码。
有谁知道可能出现什么问题?
答案 0 :(得分:2)
您需要使用组件名称,只需“id”就无法使用
<input type="text" value="[-Infinite - +Infinite]" id="initial..asset.amount.param0" name="comp1" />
并且
request.getParameter("comp1");