-2

How to pass linkedhashmap from java servlet to jsp using request.setatttibute() and how to use it in the jsp`

LinkedHashmap<String,Person> link = new LinkedHashmap<String,Person>()
request.settattribute("hash",link)

Now how do I get it in the jsp and make it work

1 Answers1

0

Here is how you can put the request attribute and then get it.

    Map link = new LinkedHashMap();
    link.put("key", "value");
    //put map as request attribute 
    request.setAttribute("hash",link);
    //get map as request attribute from the request
    Map link1 =(Map)request.getAttribute("hash");
Har Krishan
  • 273
  • 1
  • 11