我们的登录页面有一个问题,它有一个使用 post 方法的表单,问题是有时 post 参数到服务器时为空,但它们不为空。表单验证器的行为就像未输入参数一样。我把我的表单代码放在下面。你有什么想法或直觉吗?
protected class LoginForm extends OurForm {
private static final long serialVersionUID = -5813819309808445973L;
public LoginForm(String id) {
super(id);
setDefaultModel(new CompoundPropertyModel<Map<Object , Object>>(iMap));
TextField<String> userId=new TextField<String>("USERCODE" , String.class);
userId.setOutputMarkupId(true);
userId.setRequired(true);
add(userId);
PasswordTextField password = new PasswordTextField("USERPASSWORD");
password.setOutputMarkupId(true);
password.setRequired(true);
add(password);
add(new SubmitLink("SUBMIT"));
}
wicket 生成的 html 表单代码:
<form autocomplete="off" id="id2" method="post" action=";jsessionid=989511050F24C577A23CF7CC55BC9757.salacakEUPT?x=UYCQLoTt3sXylAFd5u7DPGpiOKN9Mx4oErlMwLtbLndItHXg9LDIrg"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input type="hidden" name="id2_hf_0" id="id2_hf_0" /></div>
<table width="100%">
<tr><td colspan="3"><h2> </h2></td></tr>
<tr><td width="10%"> </td>
<td width="80%">
<table width="100%">
<tr><td colspan="2" height="100"> </td></tr>
<tr>
<td align="right" width="50%"><label class="label" >Kullanıcı Kodu</label></td>
<td align="left" width="50%"><input type="text" value="" name="USERCODE" id="id3"/></td>
</tr>
<tr>
<td align="right"><label class="label" >Şifre</label></td>
<td align="left" ><input type="password" value="" name="USERPASSWORD" id="id4"/></td>
</tr>
<tr><td colspan="2" height="20"> </td></tr>
<tr><td colspan="2" align="center"><input type="submit" id="id5" onclick="var wcall=euptWicketSubmitFormById('id2', ';jsessionid=989511050F24C577A23CF7CC55BC9757.salacakEUPT?x=UYCQLoTt3sXylAFd5u7DPIvNsZm6zLH4Nn8IO6OcpRl09M**bsF1rsqDb-hhJWazVdFfqhn-IWmQiM30HCroAnex3YAslQLnMwTnZBT5fO6Cuav6A95RGA', 'SUBMIT' ,function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$$(this)&&Wicket.$$('id2')}.bind(this));;; return false;" submitlink="true" value="Giriş"/></td></tr>
<tr><td colspan="2" height="100"> </td></tr>
</table>
</td>
<td width="10%"></td></tr></table>
</form>
注意:有时并非每次都会出现此问题。