TOMCAT 5.0
JDK 5.0
代码:
public class CompanyInfoPage extends WebPage {
private static final long serialVersionUID = 7269806986218893064L;
public CompanyInfoPage(){
super();
//HttpServletRequest request=getWebRequestCycle().getWebRequest().getHttpServletRequest();
//HttpSession session = request.getSession();
//Loginer loginer = (Loginer )session.getAttribute("loginer");
Reguser reguser_p = new Reguser();
reguser_p.setRegid( Integer.valueOf(30) );
RegisterImpl registerImpl = new RegisterImpl();
Reguser reguser = registerImpl.getReguser( reguser_p );
this.add( new FeedbackPanel("feedback") );
Form form = new Form("form",new CompoundPropertyModel(reguser) ){
private static final long serialVersionUID = 1L;
protected void onSubmit(){
Reguser reguser = ((Reguser )this.getModelObject());
ReguserImpl reguserImpl = new ReguserImpl();
System.out.println( "================" + reguser.getAddress() );
if( reguserImpl.setReguser(reguser) )
info("修改成功");
else
info("修改失败");
}
};
Label name = new Label("name");
Label shortname = new Label("shortname");
..........
TextField email = new TextField("email");
TextField homepage = new TextField("homepage");
TextField bankone = new TextField("bankone");
form.add( address );
form.add( postalcode );
form.add( telone );
Button button = new Button("button");
form.add( button );
this.add( form );
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<body>
<span wicket:id="feedback" align="center"></span>
<form wicket:id="form">
<table align="center" width="600" style="border:1px solid #0D72A3;font-family:Arial;font-size:10pt;color:#0D72A3;">
<tr>
<td width="80">公司名称:</td>
<tr>
<td>地址:</td>
<td><input type="text" wicket:id="address" ></input></td>
<td>邮编:</td>
<td><input type="text" wicket:id="postalcode" ></input></td>
</tr>
..........................
<tr>
<td></td>
<td colspan="3"><input type="submit" wicket:id="button" value="提交" ></input></td>
</tr>
</table>
</form>
</body>
</html>
页面显示时, 中文都是正常.如 填写了地址的中文内容,点"提交", 后台System.out.println( "================" + reguser.getAddress() );就打印出了乱码.然后页面也变成乱码,不知为何,也找不到相关WICKET相关方面的资料,请看看.
JDK 5.0
代码:
public class CompanyInfoPage extends WebPage {
private static final long serialVersionUID = 7269806986218893064L;
public CompanyInfoPage(){
super();
//HttpServletRequest request=getWebRequestCycle().getWebRequest().getHttpServletRequest();
//HttpSession session = request.getSession();
//Loginer loginer = (Loginer )session.getAttribute("loginer");
Reguser reguser_p = new Reguser();
reguser_p.setRegid( Integer.valueOf(30) );
RegisterImpl registerImpl = new RegisterImpl();
Reguser reguser = registerImpl.getReguser( reguser_p );
this.add( new FeedbackPanel("feedback") );
Form form = new Form("form",new CompoundPropertyModel(reguser) ){
private static final long serialVersionUID = 1L;
protected void onSubmit(){
Reguser reguser = ((Reguser )this.getModelObject());
ReguserImpl reguserImpl = new ReguserImpl();
System.out.println( "================" + reguser.getAddress() );
if( reguserImpl.setReguser(reguser) )
info("修改成功");
else
info("修改失败");
}
};
Label name = new Label("name");
Label shortname = new Label("shortname");
..........
TextField email = new TextField("email");
TextField homepage = new TextField("homepage");
TextField bankone = new TextField("bankone");
form.add( address );
form.add( postalcode );
form.add( telone );
Button button = new Button("button");
form.add( button );
this.add( form );
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<body>
<span wicket:id="feedback" align="center"></span>
<form wicket:id="form">
<table align="center" width="600" style="border:1px solid #0D72A3;font-family:Arial;font-size:10pt;color:#0D72A3;">
<tr>
<td width="80">公司名称:</td>
<tr>
<td>地址:</td>
<td><input type="text" wicket:id="address" ></input></td>
<td>邮编:</td>
<td><input type="text" wicket:id="postalcode" ></input></td>
</tr>
..........................
<tr>
<td></td>
<td colspan="3"><input type="submit" wicket:id="button" value="提交" ></input></td>
</tr>
</table>
</form>
</body>
</html>
页面显示时, 中文都是正常.如 填写了地址的中文内容,点"提交", 后台System.out.println( "================" + reguser.getAddress() );就打印出了乱码.然后页面也变成乱码,不知为何,也找不到相关WICKET相关方面的资料,请看看.