Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get a object from a list of object using JSTL?  RSS feed

Jahir Ali Mondal
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get object value from a list of object using jstl.
PersonAction.javaIt is Struts action classs

Person ps1 = new Person("Jahir","Ali");
Person ps2 = new Person("Raja","Bannerjee");
Person ps3 = new Person("Suman","Chatterjee");
Person ps4 = new Person("Sayantan","Dey");
List lpersonList = new ArrayList();
request.setAttribute("plist", lpersonList);
return mapping.findForward("Success");
public class Person {
private String firstName;
private String lastName;
public Person(String pfName,String plname){
public Person(){

public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;

<c:forEach var="ps" items="${requestScope.psList}">
<c ut value="${ps.firstName}"/><c ut value="${ps.lastName}"/>

I use jstl.1.1. I do not get any output but no exception. Before i used jstl1.0. Then a exception occurs...
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!