当我将数据从隐藏字段发送到操作时,我的问题就出现了。没有正确收集数据,结果页面收到以下消息:
在这种形式中,隐藏字段的值来自先前的查询,在查询表单中未包含的其他数据的同一页面上。这是表单的代码:
<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;
}
}
有什么问题?