0

非表示フィールドからアクションにデータを送信すると、問題が発生します。データが正しく収集されず、結果ページに次のメッセージが表示されます。

  • 値 '[Ljava.lang.String;@354c0a31' で式 'idplatos' を設定中にエラーが発生しました
  • 値 '[Ljava.lang.String;@4786b9ce' で式 'idrestaurantes' を設定中にエラーが発生しました

このフォームでは、隠しフィールドの値は前のクエリから取得され、フォームにない他のデータをクエリする同じページで正しく表示されます。フォームのコードは次のとおりです。

<s:form action="Detalles.action" namespace="/" method="POST">
        <s:hidden name="idplatos" value="idplatos"/>
        <s:hidden name="idrestaurantes" value="restaurante.idrestaurante"/>
        <s:submit key="detalles" align="center"/>
</s:form>

これはアクションからのコードです:

public class PlatoAction extends ActionSupport {

private ArrayList <Platos> detalles;
private int idplatos;
private int idrestaurantes;

public String execute() throws Exception {

    Platos plato = new Platos();
    Restaurantes restaurante = new Restaurantes();

    plato.setIdplatos(getIdplatos());
    restaurante.setIdrestaurantes(getIdrestaurantes());

    System.out.println("idpla");
    System.out.println("idpres");

InterfacePlatosDAO PlatosDAO = FactoriaDAO.getPlatosDAO("MySQL");
detalles = PlatosDAO.detallePlato(plato, restaurante);

return SUCCESS;
}

public ArrayList<Platos> getDetalles() {
    return detalles;
}

public void setDetalles(ArrayList<Platos> detalles) {
    this.detalles = detalles;
}

public int getIdplatos() {
    return idplatos;
}

public void setIdplatos(int idplatos) {
    this.idplatos = idplatos;
}

public int getIdrestaurantes() {
    return idrestaurantes;
}

public void setIdrestaurantes(int idrestaurantes) {
    this.idrestaurantes = idrestaurantes;
}
}

何が問題ですか?

4

0 に答える 0