Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
set struts hashmap value in javascript

The below js code does not set the value to hashmap.

POJO:

private HashMap myMap = new HashMap();
public String getHashmapField(String key) {

    return (String) myMap.get(key);
}

public void setHashmapField(String key, String val) {
    myMap.put(key, val);
}

jsp field:

<input type="hidden" id="hashmapField(lastname)" name="hashmapField(lastname)" />

js code:

document.getElementById("hashmapField(lastname)").value = "XYZ";
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As far as I remember you should use special tags to set values.

https://struts.apache.org/tag-developers/hidden-tag.html

in this case:

<s:hidden name="foo" value="%{hashmapField}" />

I don't know how you set the object that has hashmapField so I can't say if it needs to be prefixed but check the documentation and see if this is what you need.

The code that you have, unless things have changed a lot, doesn't actually use any properties from the server. At the very least I would expect %{...}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda