有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在mysql workbench中输入中文值但显示垃圾

private EntryContentTable entryContentTable ;
private String ent_content_type;
private String entry_con_val;
private String entry_con_tag;
private int ent_con_hide;

public String execute(){
    String flag=INPUT;

    System.out.println("hello");
    try {
        session=ConnectionProvider.getSession();
        transaction=session.beginTransaction();

        entryContentTable=new EntryContentTable();

        entryContentTable.setEntry_cont_type(getEnt_content_type());
        entryContentTable.setEntry_cont_value(getEntry_con_val());
        entryContentTable.setEntry_cont_tag_name(getEntry_con_tag());

        session.save(entryContentTable);
        transaction.commit();
        flag = SUCCESS;
    } catch (Exception e) {
    System.out.println(e.toString());
    e.printStackTrace();
    }
    finally{
        return flag;
    }

}
public String entconupdate() {
     String flag=SUCCESS; 
    try{
        System.out.println("HIde Value mmmmmmmmm  ::: " +  ent_con_hide);
         session=ConnectionProvider.getSession();
         transaction=session.beginTransaction();

         entryContentTable=(EntryContentTable)session.load(EntryContentTable.class, ent_con_hide);


         entryContentTable.setEntry_cont_type(getEnt_content_type());
            entryContentTable.setEntry_cont_value(getEntry_con_val());
            entryContentTable.setEntry_cont_tag_name(getEntry_con_tag());

            session.update(entryContentTable);

            transaction.commit();

        return flag;
    }catch (Exception e) {
        e.printStackTrace();
        System.out.println("Exception in update ECMA Action :: " + e.toString());
        flag = INPUT ; 
        return flag;
    }


}
@Override
public void setSession(Map map) {
    this.sessionmap = map;

}
public String getEnt_content_type() {
    return ent_content_type;
}
public void setEnt_content_type(String ent_content_type) {
    this.ent_content_type = ent_content_type;
}
public String getEntry_con_val() {
    return entry_con_val;
}
public void setEntry_con_val(String entry_con_val) {
    this.entry_con_val = entry_con_val;
}
public String getEntry_con_tag() {
    return entry_con_tag;
}
public void setEntry_con_tag(String entry_con_tag) {
    this.entry_con_tag = entry_con_tag;
}
public EntryContentTable getEntryContentTable() {
    return entryContentTable;
}
public void setEntryContentTable(EntryContentTable entryContentTable) {
    this.entryContentTable = entryContentTable;
}
public int getEnt_con_hide() {
    return ent_con_hide;
}
public void setEnt_con_hide(int ent_con_hide) {
    this.ent_con_hide = ent_con_hide;
}

}

这是我的java类,我通过jsp页面输入中文值,但它显示的是垃圾 数据库中的值,即mysql workbench。 我阅读了xml文件中的中文数据,但jsp页面没有显示中文数据=


共 (0) 个答案