My problem happens when I send data from hidden fields to action. No data collected properly and the result page I receive the following message:
- Error setting expression 'idplatos' with value '[Ljava.lang.String;@354c0a31'
- Error setting expression 'idrestaurantes' with value '[Ljava.lang.String;@4786b9ce'
In this form the value of hidden fields come from a previous query, on the same page that query other data that are not in the form is displayed correctly.This the code for form:
<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>
This is the code from action:
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;
}
}
What is the problem?