论坛首页 Java企业应用论坛

wicket中出现中文的乱码

浏览 2703 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2007-04-10  
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相关方面的资料,请看看.
   发表时间:2007-04-11  
原来是过滤器的问题.
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics