Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!