I have a class where I am creating a non empty ArrayList and putting it is not a session. Now, I want to iterate that list which kept in session into my JSP page.
I tried it but nothing is coming.
in action class
..................
books = new ArrayList<Bookdetails>();
session.put(BillTransactionBooksConstants.BOK, books);
return SUCCUSS;
Note : I tested my list is not empty and it is correctly adding into session.
My only problem is how can I show this list into my JSP from session.
BillTransactionBooksConstants:
package v.esoft.actions.booktransaction;
public class BillTransactionBooksConstants
{
public static final String BOK = "BOK";
}
shortbill.jsp:
<s:iterator value="#session.BillTransactionBooksConstants.BOK" status="userStatus">
<s:property value="Bookdetails.bookTitile" />
<br/>
</s:iterator>
Refer only to the property name, and use the constant value directly:
Note that I’ve corrected the spelling of the property.
Also note that “SUCCESS” is spelled “SUCCESS”, not “SUCCUSS”.
If you wish to use the constant name you should be able to use the following, but I didn’t test it:
Assuming static member access is enabled.