0

I'm working on java web application and am using struts2 framework. I need to pass HashMap or LinkedList from Action class to jsp page to displaying all records.

I do not want to use <%@ taglib prefix="s" uri="/struts-tags" %> library to fetch all records from jsp page.

my code -

public class ViewStatusSHAction extends ActionSupport {

private LinkedList<SBean> humans = null;
private LinkedHashMap<String, String> hashMap =null;

public LinkedHashMap<String, String> getHashMap() {
    return hashMap;
}

public void setHashMap(LinkedHashMap<String, String> hashMap) {
    this.hashMap = hashMap;
}

public LinkedList<SBean> getHumans() {
    return humans;
}

public void setHumans(LinkedList<SBean> humans) {
    this.humans = humans;
}

public String execute() {
    this.setHumans(new ViewStatusSHModel().getHumanDetails());
    return Action.SUCCESS;
}
}

I want to use JSP syntax to display all recoreds fetched from action, but I don't know to how to get all records without <s:iterator></s:iterator> tags?.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Which tag do you want to use instead of iterator tag or may be you don't want to use JSP tags? – Roman C Jan 17 '15 at 14:04
  • You can use [JSTL's forEach, with JSP EL](http://stackoverflow.com/a/20467947/1654265). But I suggest you to stick with the Struts tags, unless you already know JSTL (it seems you don't) or you jump from S2 to not-S2 projects, where struts tags are not available. – Andrea Ligios Jan 19 '15 at 10:07
  • It's not clear what you're asking. – Dave Newton Jan 20 '15 at 00:41

0 Answers0