0

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?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
user3387682
  • 101
  • 1
  • 2
  • 12
  • Check what values are being submitted. – Aleksandr M Mar 06 '14 at 10:57
  • the problem is that I do not take the value of these two fields in the form have to then move to a new query and shows me the page of results in the following error: Error setting expression 'idplatos' with value '[Ljava.lang.String;@354c0a31' Error setting expression 'idrestaurantes' with value '[Ljava.lang.String;@4786b9ce' It's as if I did not recognize that value. – user3387682 Mar 06 '14 at 11:07
  • The action can not be performed because the new query collects data from the form fields well. Sorry for my English ... it's depressing .... – user3387682 Mar 06 '14 at 11:11
  • Inspect your form in the browser before submitting. – Aleksandr M Mar 06 '14 at 11:17
  • I just checked on the form that the value of the fields I do not collect. But if I take it out of the form and put it into a property correctly shows me what its value ...... why? – user3387682 Mar 06 '14 at 11:40
  • Already solved, the problem was that, for the form of the iterator value pick was necessary to place: value = "% {restaurante.idrestaurante}" Thank you very much for the help – user3387682 Mar 06 '14 at 12:03
  • You can put your solution as an answer to help future visitors with this problem. – Aleksandr M Mar 06 '14 at 12:28

0 Answers0