• Post Reply Bookmark Topic Watch Topic
  • New Topic

Access Arraylist of Custom Java Object in JSTL  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java Entity named MyEntity which has getter and settter methods for id and name fields. I create 5 instances of MyEntity with different id's and Name's and store all of them in an arraylist. Finally I place the arraylist in the session Object.

I have the following on my jsp page
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html-el"%>
<jsp:useBean id="myEntity" scope="session" type="com.test.entity.MyEntity"/>

<c:set var="myList" value="${sessionScope.}"/> //I don't know what should go here as the object is not in the session, but the arraylist with objects is available.

<c:forEach var="testList" items="${myList}" varStatus="status">
alert(<cut value="${testList.}"/>) //Not sure what goes here as I don't know what I have in myList yet.

Could you help me.

Thanks a lot

I Got it on my own.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!