0
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 ワークベンチであるデータベースにガベージ値が表示されています。中国語データの xml ファイルを読みましたが、jsp ページに中国語データが表示されません =?

4

2 に答える 2

0

デバッグするには...

  1. Unicode をサポートする Notepad++ などの XML エディターに XML ファイルを読み込みます。
  2. JSP ファイルで、Unicode を返すことが明示的に記述されていることを確認してください。これは、JSP を使用するための出発点です。
  3. MySQL テーブルが Unicode を使用していることを確認してください。
于 2013-07-15T11:18:28.877 に答える
0

これには UTF8 文字エンコーディングを使用して、データベースとテーブルの正しいフェッチ メタデータを使用していることを確認してください。

テーブルについては、次のコマンドで確認してください。

show create table table_name;
于 2013-07-15T11:23:38.907 に答える