displaying arraylist in session- STRUTS


Web tier: servlets, JSP, Web frameworks: displaying arraylist in session- STRUTS

  1. displaying arraylist in session- STRUTS (1 messages)

    I have a Arrylist and HashMap in a Action Class like this ArrayList schoolList = new ArrayList(); schoolList.add("HighSchool"); schoolList.add("middleSchool"); schoolList.add("HigherSecondarySchool"); schoolList.add("Convent"); and a HashMap i have one like this HashMap bookMap = new HashMap(); ArrayList bookList1 = new ArrayList(); bookList1.add("Kamal"); bookList1.add("Ramu"); bookList1 .add("Kumar"); bookList1.add("samy"); String book1 = "Java"; bookMap.put(book1,bookList1); ArrayList bookList2 = new ArrayList(); bookList2.add("Raju"); bookList2.add("Ramu"); bookList2 .add("Baskar"); bookList2.add("Prba"); String book2 = ".Net"; bookMap.put(book2,bookList2); I add this in session like session.setAttribute("schoolList",schoolList); session.setAttribute("books",bookMap); I want to display this values in JSP like SchoolList HighSchool middleSchool HigherSecondarySchool Convent BookLists Name----------Authors java ------------- Kamal java ------------- Ramu java ------------- Kumar java ------------- samy .Net ------------- Raju .Net ------------- Ramu .Net ------------- Baskar .Net ------------- Prba The problem is i ma not using formBean for these values. i am retrieving values in jsp like ArrayList schoolList = (ArrayList)session.getAttribute("schoolList"); HahsMap bookMap = session.getAttribute("books"); I am trying to use logic:iterate tag for these, but they are giving nullpointer exception or it says no variable difiened. pls help me to resolve this
  2. Hello How are you writing the tag?? I think it should looks like: regards.