javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied “items” in <forEach>












0















I DID try to follow the solution for the similar problem this post, but somehow I am still getting the error:



javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>



I have object within an object. I don't know how to print being newbie.



@Component
@Entity
@Table(name = "CUSTOMER")
public class CustomerVO {

@Id
@SequenceGenerator(name = "customer_seq", sequenceName = "CUSTOMER_SEQ",
allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "customer_seq")
@Column(name = "ID")
private int id;
@Column(name = "CUSTOMERID")
private long customerId;
@Column(name = "LOGINID")
private String loginId;
@Column(name = "PASSWORD")
private String password;

@UpdateTimestamp
@Column(name = "MODIFIED_TIMESTAMP")
private Timestamp modTimestamp;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "CUST_PROFILE_ID")
private CustomerProfileVO customerProfileVO = new CustomerProfileVO();

public CustomerVO() {
}

public CustomerVO(int id, long customerId, String loginId, String password,
Timestamp modTimestamp,
CustomerProfileVO customerProfileVO) {
this.id = id;
this.customerId = customerId;
this.loginId = loginId;
this.password = password;
this.modTimestamp = modTimestamp;
this.customerProfileVO = customerProfileVO;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public long getCustomerId() {
return customerId;
}

public void setCustomerId(long customerId) {
this.customerId = customerId;
}

public String getLoginId() {
return loginId;
}

public void setLoginId(String loginId) {
this.loginId = loginId;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public Timestamp getModTimestamp() {
return modTimestamp;
}

public void setModTimestamp(Timestamp modTimestamp) {
this.modTimestamp = modTimestamp;
}

public CustomerProfileVO getCustomerProfileVO() {
return customerProfileVO;
}

public void setCustomerProfileVO(CustomerProfileVO customerProfileVO) {
this.customerProfileVO = customerProfileVO;
}

@Override
public String toString() {
return "CustomerVO [id=" + id + ", customerId=" + customerId + ",
loginId=" + loginId + ", password=" + password
+ ", modTimestamp=" + modTimestamp + ", customerProfileVO=" +
customerProfileVO + "]";
}

}




CustomerProfileVO.java



@Component
@Entity
@Table(name = "CUSTOMER_PROFILE")
public class CustomerProfileVO {

@Id
@SequenceGenerator(name = "customer_profile_seq", sequenceName =
"CUSTOMER_PROFILE_SEQ", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator =
"customer_profile_seq")
@Column(name = "ID")
private int id;
@Column(name = "FIRSTNAME")
private String firstName;
@Column(name = "LASTNAME")
private String lastName;
@Column(name = "AGE")
private int age;
@Column(name = "GENDER")
private char gender;
@Column(name = "DOB")
private Date dob;
@Column(name = "DOORNO")
private int doorNo;
@Column(name = "STREETNAME")
private String streetName;
@Column(name = "CITY")
private String city;
@Column(name = "STATE")
private String state;
@Column(name = "ZIPCODE")
private String zipcode;
@Column(name = "PROFILESTATUSCODE")
private String profileStatus;

public CustomerProfileVO() {

}

public CustomerProfileVO(int id, String firstName, String lastName, int age, char gender, Date dob, int doorNo,
String streetName, String city, String state, String zipcode, String profileStatus) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
this.dob = dob;
this.doorNo = doorNo;
this.streetName = streetName;
this.city = city;
this.state = state;
this.zipcode = zipcode;
this.profileStatus = profileStatus;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

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;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public char getGender() {
return gender;
}

public void setGender(char gender) {
this.gender = gender;
}

public Date getDob() {
return dob;
}

public void setDob(Date dob) {
this.dob = dob;
}

public int getDoorNo() {
return doorNo;
}

public void setDoorNo(int doorNo) {
this.doorNo = doorNo;
}

public String getStreetName() {
return streetName;
}

public void setStreetName(String streetName) {
this.streetName = streetName;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getZipcode() {
return zipcode;
}

public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}

public String getProfileStatus() {
return profileStatus;
}

public void setProfileStatus(String profileStatus) {
this.profileStatus = profileStatus;
}

@Override
public String toString() {
return "CustomerProfileVO [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", age=" + age
+ ", gender=" + gender + ", dob=" + dob + ", doorNo=" + doorNo + ", streetName=" + streetName
+ ", city=" + city + ", state=" + state + ", zipcode=" + zipcode + ", profileStatus=" + profileStatus
+ "]";
}


}





customerProfile.jsp



<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
<title>Login and Registration Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Login and Registration Form with HTML5 and CSS3" />
<meta name="keywords"
content="html5, css3, form, switch, animation, :target, pseudo-class" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/resources/css/demo.css" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/resources/css/style.css" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/resources/css/animate-custom.css"
/>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/resources/css/bootstrap.css" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/resources/css/app.css" />
</head>
<body>
<div class="container">
<header>
<h1>
User List</span>
</h1>
</header>
<section>
<div id="container_demo">

<div id="wrapper">
<div>
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>LOGIN</th>
<th>PASSWORD</th>
</tr>
</thead>
<tbody>
<c:forEach var="c" items="${customer}">
<tr>
<td>${c.id}</td>
<td>${c.loginId}</td>
<td>${c.password}</td>
<c:forEach var="x"
items="${customer.customerProfileVO}">
<td>${x.firstName}</td>
</c:forEach>

<td><a href="/edit-user-${c.id}"
class="btn btn-success custom-
width">edit</a></td>
<td><a href="/delete-user-${c.id}"
class="btn btn-danger custom-
width">delete</a></td>
</tr>
</c:forEach>
</tbody>
</table>

</div>

</div>
</div>
</section>
</div>
</body>
</html>









share|improve this question



























    0















    I DID try to follow the solution for the similar problem this post, but somehow I am still getting the error:



    javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>



    I have object within an object. I don't know how to print being newbie.



    @Component
    @Entity
    @Table(name = "CUSTOMER")
    public class CustomerVO {

    @Id
    @SequenceGenerator(name = "customer_seq", sequenceName = "CUSTOMER_SEQ",
    allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "customer_seq")
    @Column(name = "ID")
    private int id;
    @Column(name = "CUSTOMERID")
    private long customerId;
    @Column(name = "LOGINID")
    private String loginId;
    @Column(name = "PASSWORD")
    private String password;

    @UpdateTimestamp
    @Column(name = "MODIFIED_TIMESTAMP")
    private Timestamp modTimestamp;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "CUST_PROFILE_ID")
    private CustomerProfileVO customerProfileVO = new CustomerProfileVO();

    public CustomerVO() {
    }

    public CustomerVO(int id, long customerId, String loginId, String password,
    Timestamp modTimestamp,
    CustomerProfileVO customerProfileVO) {
    this.id = id;
    this.customerId = customerId;
    this.loginId = loginId;
    this.password = password;
    this.modTimestamp = modTimestamp;
    this.customerProfileVO = customerProfileVO;
    }

    public int getId() {
    return id;
    }

    public void setId(int id) {
    this.id = id;
    }

    public long getCustomerId() {
    return customerId;
    }

    public void setCustomerId(long customerId) {
    this.customerId = customerId;
    }

    public String getLoginId() {
    return loginId;
    }

    public void setLoginId(String loginId) {
    this.loginId = loginId;
    }

    public String getPassword() {
    return password;
    }

    public void setPassword(String password) {
    this.password = password;
    }

    public Timestamp getModTimestamp() {
    return modTimestamp;
    }

    public void setModTimestamp(Timestamp modTimestamp) {
    this.modTimestamp = modTimestamp;
    }

    public CustomerProfileVO getCustomerProfileVO() {
    return customerProfileVO;
    }

    public void setCustomerProfileVO(CustomerProfileVO customerProfileVO) {
    this.customerProfileVO = customerProfileVO;
    }

    @Override
    public String toString() {
    return "CustomerVO [id=" + id + ", customerId=" + customerId + ",
    loginId=" + loginId + ", password=" + password
    + ", modTimestamp=" + modTimestamp + ", customerProfileVO=" +
    customerProfileVO + "]";
    }

    }




    CustomerProfileVO.java



    @Component
    @Entity
    @Table(name = "CUSTOMER_PROFILE")
    public class CustomerProfileVO {

    @Id
    @SequenceGenerator(name = "customer_profile_seq", sequenceName =
    "CUSTOMER_PROFILE_SEQ", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator =
    "customer_profile_seq")
    @Column(name = "ID")
    private int id;
    @Column(name = "FIRSTNAME")
    private String firstName;
    @Column(name = "LASTNAME")
    private String lastName;
    @Column(name = "AGE")
    private int age;
    @Column(name = "GENDER")
    private char gender;
    @Column(name = "DOB")
    private Date dob;
    @Column(name = "DOORNO")
    private int doorNo;
    @Column(name = "STREETNAME")
    private String streetName;
    @Column(name = "CITY")
    private String city;
    @Column(name = "STATE")
    private String state;
    @Column(name = "ZIPCODE")
    private String zipcode;
    @Column(name = "PROFILESTATUSCODE")
    private String profileStatus;

    public CustomerProfileVO() {

    }

    public CustomerProfileVO(int id, String firstName, String lastName, int age, char gender, Date dob, int doorNo,
    String streetName, String city, String state, String zipcode, String profileStatus) {
    this.id = id;
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
    this.gender = gender;
    this.dob = dob;
    this.doorNo = doorNo;
    this.streetName = streetName;
    this.city = city;
    this.state = state;
    this.zipcode = zipcode;
    this.profileStatus = profileStatus;
    }

    public int getId() {
    return id;
    }

    public void setId(int id) {
    this.id = id;
    }

    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;
    }

    public int getAge() {
    return age;
    }

    public void setAge(int age) {
    this.age = age;
    }

    public char getGender() {
    return gender;
    }

    public void setGender(char gender) {
    this.gender = gender;
    }

    public Date getDob() {
    return dob;
    }

    public void setDob(Date dob) {
    this.dob = dob;
    }

    public int getDoorNo() {
    return doorNo;
    }

    public void setDoorNo(int doorNo) {
    this.doorNo = doorNo;
    }

    public String getStreetName() {
    return streetName;
    }

    public void setStreetName(String streetName) {
    this.streetName = streetName;
    }

    public String getCity() {
    return city;
    }

    public void setCity(String city) {
    this.city = city;
    }

    public String getState() {
    return state;
    }

    public void setState(String state) {
    this.state = state;
    }

    public String getZipcode() {
    return zipcode;
    }

    public void setZipcode(String zipcode) {
    this.zipcode = zipcode;
    }

    public String getProfileStatus() {
    return profileStatus;
    }

    public void setProfileStatus(String profileStatus) {
    this.profileStatus = profileStatus;
    }

    @Override
    public String toString() {
    return "CustomerProfileVO [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", age=" + age
    + ", gender=" + gender + ", dob=" + dob + ", doorNo=" + doorNo + ", streetName=" + streetName
    + ", city=" + city + ", state=" + state + ", zipcode=" + zipcode + ", profileStatus=" + profileStatus
    + "]";
    }


    }





    customerProfile.jsp



    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html>
    <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
    <!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
    <!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
    <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
    <!--[if (gt IE 9)|!(IE)]><!-->
    <html lang="en" class="no-js">
    <!--<![endif]-->
    <head>
    <meta charset="UTF-8" />
    <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
    <title>Login and Registration Form</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description"
    content="Login and Registration Form with HTML5 and CSS3" />
    <meta name="keywords"
    content="html5, css3, form, switch, animation, :target, pseudo-class" />
    <meta name="author" content="Codrops" />
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath}/resources/css/demo.css" />
    <link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath}/resources/css/style.css" />
    <link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath}/resources/css/animate-custom.css"
    />
    <link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath}/resources/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath}/resources/css/app.css" />
    </head>
    <body>
    <div class="container">
    <header>
    <h1>
    User List</span>
    </h1>
    </header>
    <section>
    <div id="container_demo">

    <div id="wrapper">
    <div>
    <table class="table table-hover">
    <thead>
    <tr>
    <th>ID</th>
    <th>LOGIN</th>
    <th>PASSWORD</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="c" items="${customer}">
    <tr>
    <td>${c.id}</td>
    <td>${c.loginId}</td>
    <td>${c.password}</td>
    <c:forEach var="x"
    items="${customer.customerProfileVO}">
    <td>${x.firstName}</td>
    </c:forEach>

    <td><a href="/edit-user-${c.id}"
    class="btn btn-success custom-
    width">edit</a></td>
    <td><a href="/delete-user-${c.id}"
    class="btn btn-danger custom-
    width">delete</a></td>
    </tr>
    </c:forEach>
    </tbody>
    </table>

    </div>

    </div>
    </div>
    </section>
    </div>
    </body>
    </html>









    share|improve this question

























      0












      0








      0








      I DID try to follow the solution for the similar problem this post, but somehow I am still getting the error:



      javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>



      I have object within an object. I don't know how to print being newbie.



      @Component
      @Entity
      @Table(name = "CUSTOMER")
      public class CustomerVO {

      @Id
      @SequenceGenerator(name = "customer_seq", sequenceName = "CUSTOMER_SEQ",
      allocationSize = 1)
      @GeneratedValue(strategy = GenerationType.AUTO, generator = "customer_seq")
      @Column(name = "ID")
      private int id;
      @Column(name = "CUSTOMERID")
      private long customerId;
      @Column(name = "LOGINID")
      private String loginId;
      @Column(name = "PASSWORD")
      private String password;

      @UpdateTimestamp
      @Column(name = "MODIFIED_TIMESTAMP")
      private Timestamp modTimestamp;

      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(name = "CUST_PROFILE_ID")
      private CustomerProfileVO customerProfileVO = new CustomerProfileVO();

      public CustomerVO() {
      }

      public CustomerVO(int id, long customerId, String loginId, String password,
      Timestamp modTimestamp,
      CustomerProfileVO customerProfileVO) {
      this.id = id;
      this.customerId = customerId;
      this.loginId = loginId;
      this.password = password;
      this.modTimestamp = modTimestamp;
      this.customerProfileVO = customerProfileVO;
      }

      public int getId() {
      return id;
      }

      public void setId(int id) {
      this.id = id;
      }

      public long getCustomerId() {
      return customerId;
      }

      public void setCustomerId(long customerId) {
      this.customerId = customerId;
      }

      public String getLoginId() {
      return loginId;
      }

      public void setLoginId(String loginId) {
      this.loginId = loginId;
      }

      public String getPassword() {
      return password;
      }

      public void setPassword(String password) {
      this.password = password;
      }

      public Timestamp getModTimestamp() {
      return modTimestamp;
      }

      public void setModTimestamp(Timestamp modTimestamp) {
      this.modTimestamp = modTimestamp;
      }

      public CustomerProfileVO getCustomerProfileVO() {
      return customerProfileVO;
      }

      public void setCustomerProfileVO(CustomerProfileVO customerProfileVO) {
      this.customerProfileVO = customerProfileVO;
      }

      @Override
      public String toString() {
      return "CustomerVO [id=" + id + ", customerId=" + customerId + ",
      loginId=" + loginId + ", password=" + password
      + ", modTimestamp=" + modTimestamp + ", customerProfileVO=" +
      customerProfileVO + "]";
      }

      }




      CustomerProfileVO.java



      @Component
      @Entity
      @Table(name = "CUSTOMER_PROFILE")
      public class CustomerProfileVO {

      @Id
      @SequenceGenerator(name = "customer_profile_seq", sequenceName =
      "CUSTOMER_PROFILE_SEQ", allocationSize = 1)
      @GeneratedValue(strategy = GenerationType.AUTO, generator =
      "customer_profile_seq")
      @Column(name = "ID")
      private int id;
      @Column(name = "FIRSTNAME")
      private String firstName;
      @Column(name = "LASTNAME")
      private String lastName;
      @Column(name = "AGE")
      private int age;
      @Column(name = "GENDER")
      private char gender;
      @Column(name = "DOB")
      private Date dob;
      @Column(name = "DOORNO")
      private int doorNo;
      @Column(name = "STREETNAME")
      private String streetName;
      @Column(name = "CITY")
      private String city;
      @Column(name = "STATE")
      private String state;
      @Column(name = "ZIPCODE")
      private String zipcode;
      @Column(name = "PROFILESTATUSCODE")
      private String profileStatus;

      public CustomerProfileVO() {

      }

      public CustomerProfileVO(int id, String firstName, String lastName, int age, char gender, Date dob, int doorNo,
      String streetName, String city, String state, String zipcode, String profileStatus) {
      this.id = id;
      this.firstName = firstName;
      this.lastName = lastName;
      this.age = age;
      this.gender = gender;
      this.dob = dob;
      this.doorNo = doorNo;
      this.streetName = streetName;
      this.city = city;
      this.state = state;
      this.zipcode = zipcode;
      this.profileStatus = profileStatus;
      }

      public int getId() {
      return id;
      }

      public void setId(int id) {
      this.id = id;
      }

      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;
      }

      public int getAge() {
      return age;
      }

      public void setAge(int age) {
      this.age = age;
      }

      public char getGender() {
      return gender;
      }

      public void setGender(char gender) {
      this.gender = gender;
      }

      public Date getDob() {
      return dob;
      }

      public void setDob(Date dob) {
      this.dob = dob;
      }

      public int getDoorNo() {
      return doorNo;
      }

      public void setDoorNo(int doorNo) {
      this.doorNo = doorNo;
      }

      public String getStreetName() {
      return streetName;
      }

      public void setStreetName(String streetName) {
      this.streetName = streetName;
      }

      public String getCity() {
      return city;
      }

      public void setCity(String city) {
      this.city = city;
      }

      public String getState() {
      return state;
      }

      public void setState(String state) {
      this.state = state;
      }

      public String getZipcode() {
      return zipcode;
      }

      public void setZipcode(String zipcode) {
      this.zipcode = zipcode;
      }

      public String getProfileStatus() {
      return profileStatus;
      }

      public void setProfileStatus(String profileStatus) {
      this.profileStatus = profileStatus;
      }

      @Override
      public String toString() {
      return "CustomerProfileVO [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", age=" + age
      + ", gender=" + gender + ", dob=" + dob + ", doorNo=" + doorNo + ", streetName=" + streetName
      + ", city=" + city + ", state=" + state + ", zipcode=" + zipcode + ", profileStatus=" + profileStatus
      + "]";
      }


      }





      customerProfile.jsp



      <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
      <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <!DOCTYPE html>
      <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
      <!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
      <!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
      <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
      <!--[if (gt IE 9)|!(IE)]><!-->
      <html lang="en" class="no-js">
      <!--<![endif]-->
      <head>
      <meta charset="UTF-8" />
      <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
      <title>Login and Registration Form</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description"
      content="Login and Registration Form with HTML5 and CSS3" />
      <meta name="keywords"
      content="html5, css3, form, switch, animation, :target, pseudo-class" />
      <meta name="author" content="Codrops" />
      <link rel="shortcut icon" href="../favicon.ico">
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/demo.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/style.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/animate-custom.css"
      />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/bootstrap.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/app.css" />
      </head>
      <body>
      <div class="container">
      <header>
      <h1>
      User List</span>
      </h1>
      </header>
      <section>
      <div id="container_demo">

      <div id="wrapper">
      <div>
      <table class="table table-hover">
      <thead>
      <tr>
      <th>ID</th>
      <th>LOGIN</th>
      <th>PASSWORD</th>
      </tr>
      </thead>
      <tbody>
      <c:forEach var="c" items="${customer}">
      <tr>
      <td>${c.id}</td>
      <td>${c.loginId}</td>
      <td>${c.password}</td>
      <c:forEach var="x"
      items="${customer.customerProfileVO}">
      <td>${x.firstName}</td>
      </c:forEach>

      <td><a href="/edit-user-${c.id}"
      class="btn btn-success custom-
      width">edit</a></td>
      <td><a href="/delete-user-${c.id}"
      class="btn btn-danger custom-
      width">delete</a></td>
      </tr>
      </c:forEach>
      </tbody>
      </table>

      </div>

      </div>
      </div>
      </section>
      </div>
      </body>
      </html>









      share|improve this question














      I DID try to follow the solution for the similar problem this post, but somehow I am still getting the error:



      javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>



      I have object within an object. I don't know how to print being newbie.



      @Component
      @Entity
      @Table(name = "CUSTOMER")
      public class CustomerVO {

      @Id
      @SequenceGenerator(name = "customer_seq", sequenceName = "CUSTOMER_SEQ",
      allocationSize = 1)
      @GeneratedValue(strategy = GenerationType.AUTO, generator = "customer_seq")
      @Column(name = "ID")
      private int id;
      @Column(name = "CUSTOMERID")
      private long customerId;
      @Column(name = "LOGINID")
      private String loginId;
      @Column(name = "PASSWORD")
      private String password;

      @UpdateTimestamp
      @Column(name = "MODIFIED_TIMESTAMP")
      private Timestamp modTimestamp;

      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(name = "CUST_PROFILE_ID")
      private CustomerProfileVO customerProfileVO = new CustomerProfileVO();

      public CustomerVO() {
      }

      public CustomerVO(int id, long customerId, String loginId, String password,
      Timestamp modTimestamp,
      CustomerProfileVO customerProfileVO) {
      this.id = id;
      this.customerId = customerId;
      this.loginId = loginId;
      this.password = password;
      this.modTimestamp = modTimestamp;
      this.customerProfileVO = customerProfileVO;
      }

      public int getId() {
      return id;
      }

      public void setId(int id) {
      this.id = id;
      }

      public long getCustomerId() {
      return customerId;
      }

      public void setCustomerId(long customerId) {
      this.customerId = customerId;
      }

      public String getLoginId() {
      return loginId;
      }

      public void setLoginId(String loginId) {
      this.loginId = loginId;
      }

      public String getPassword() {
      return password;
      }

      public void setPassword(String password) {
      this.password = password;
      }

      public Timestamp getModTimestamp() {
      return modTimestamp;
      }

      public void setModTimestamp(Timestamp modTimestamp) {
      this.modTimestamp = modTimestamp;
      }

      public CustomerProfileVO getCustomerProfileVO() {
      return customerProfileVO;
      }

      public void setCustomerProfileVO(CustomerProfileVO customerProfileVO) {
      this.customerProfileVO = customerProfileVO;
      }

      @Override
      public String toString() {
      return "CustomerVO [id=" + id + ", customerId=" + customerId + ",
      loginId=" + loginId + ", password=" + password
      + ", modTimestamp=" + modTimestamp + ", customerProfileVO=" +
      customerProfileVO + "]";
      }

      }




      CustomerProfileVO.java



      @Component
      @Entity
      @Table(name = "CUSTOMER_PROFILE")
      public class CustomerProfileVO {

      @Id
      @SequenceGenerator(name = "customer_profile_seq", sequenceName =
      "CUSTOMER_PROFILE_SEQ", allocationSize = 1)
      @GeneratedValue(strategy = GenerationType.AUTO, generator =
      "customer_profile_seq")
      @Column(name = "ID")
      private int id;
      @Column(name = "FIRSTNAME")
      private String firstName;
      @Column(name = "LASTNAME")
      private String lastName;
      @Column(name = "AGE")
      private int age;
      @Column(name = "GENDER")
      private char gender;
      @Column(name = "DOB")
      private Date dob;
      @Column(name = "DOORNO")
      private int doorNo;
      @Column(name = "STREETNAME")
      private String streetName;
      @Column(name = "CITY")
      private String city;
      @Column(name = "STATE")
      private String state;
      @Column(name = "ZIPCODE")
      private String zipcode;
      @Column(name = "PROFILESTATUSCODE")
      private String profileStatus;

      public CustomerProfileVO() {

      }

      public CustomerProfileVO(int id, String firstName, String lastName, int age, char gender, Date dob, int doorNo,
      String streetName, String city, String state, String zipcode, String profileStatus) {
      this.id = id;
      this.firstName = firstName;
      this.lastName = lastName;
      this.age = age;
      this.gender = gender;
      this.dob = dob;
      this.doorNo = doorNo;
      this.streetName = streetName;
      this.city = city;
      this.state = state;
      this.zipcode = zipcode;
      this.profileStatus = profileStatus;
      }

      public int getId() {
      return id;
      }

      public void setId(int id) {
      this.id = id;
      }

      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;
      }

      public int getAge() {
      return age;
      }

      public void setAge(int age) {
      this.age = age;
      }

      public char getGender() {
      return gender;
      }

      public void setGender(char gender) {
      this.gender = gender;
      }

      public Date getDob() {
      return dob;
      }

      public void setDob(Date dob) {
      this.dob = dob;
      }

      public int getDoorNo() {
      return doorNo;
      }

      public void setDoorNo(int doorNo) {
      this.doorNo = doorNo;
      }

      public String getStreetName() {
      return streetName;
      }

      public void setStreetName(String streetName) {
      this.streetName = streetName;
      }

      public String getCity() {
      return city;
      }

      public void setCity(String city) {
      this.city = city;
      }

      public String getState() {
      return state;
      }

      public void setState(String state) {
      this.state = state;
      }

      public String getZipcode() {
      return zipcode;
      }

      public void setZipcode(String zipcode) {
      this.zipcode = zipcode;
      }

      public String getProfileStatus() {
      return profileStatus;
      }

      public void setProfileStatus(String profileStatus) {
      this.profileStatus = profileStatus;
      }

      @Override
      public String toString() {
      return "CustomerProfileVO [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", age=" + age
      + ", gender=" + gender + ", dob=" + dob + ", doorNo=" + doorNo + ", streetName=" + streetName
      + ", city=" + city + ", state=" + state + ", zipcode=" + zipcode + ", profileStatus=" + profileStatus
      + "]";
      }


      }





      customerProfile.jsp



      <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
      <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <!DOCTYPE html>
      <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
      <!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
      <!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
      <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
      <!--[if (gt IE 9)|!(IE)]><!-->
      <html lang="en" class="no-js">
      <!--<![endif]-->
      <head>
      <meta charset="UTF-8" />
      <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
      <title>Login and Registration Form</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description"
      content="Login and Registration Form with HTML5 and CSS3" />
      <meta name="keywords"
      content="html5, css3, form, switch, animation, :target, pseudo-class" />
      <meta name="author" content="Codrops" />
      <link rel="shortcut icon" href="../favicon.ico">
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/demo.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/style.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/animate-custom.css"
      />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/bootstrap.css" />
      <link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/resources/css/app.css" />
      </head>
      <body>
      <div class="container">
      <header>
      <h1>
      User List</span>
      </h1>
      </header>
      <section>
      <div id="container_demo">

      <div id="wrapper">
      <div>
      <table class="table table-hover">
      <thead>
      <tr>
      <th>ID</th>
      <th>LOGIN</th>
      <th>PASSWORD</th>
      </tr>
      </thead>
      <tbody>
      <c:forEach var="c" items="${customer}">
      <tr>
      <td>${c.id}</td>
      <td>${c.loginId}</td>
      <td>${c.password}</td>
      <c:forEach var="x"
      items="${customer.customerProfileVO}">
      <td>${x.firstName}</td>
      </c:forEach>

      <td><a href="/edit-user-${c.id}"
      class="btn btn-success custom-
      width">edit</a></td>
      <td><a href="/delete-user-${c.id}"
      class="btn btn-danger custom-
      width">delete</a></td>
      </tr>
      </c:forEach>
      </tbody>
      </table>

      </div>

      </div>
      </div>
      </section>
      </div>
      </body>
      </html>






      jsp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 25 '18 at 1:17









      yoogyoog

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          In the nested c:forEach you are in context of c variable and not customer, so change items reference to:



          items="${c.customerProfileVO}">





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463882%2fjavax-servlet-jsp-jsptagexception-dont-know-how-to-iterate-over-supplied-item%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            In the nested c:forEach you are in context of c variable and not customer, so change items reference to:



            items="${c.customerProfileVO}">





            share|improve this answer




























              0














              In the nested c:forEach you are in context of c variable and not customer, so change items reference to:



              items="${c.customerProfileVO}">





              share|improve this answer


























                0












                0








                0







                In the nested c:forEach you are in context of c variable and not customer, so change items reference to:



                items="${c.customerProfileVO}">





                share|improve this answer













                In the nested c:forEach you are in context of c variable and not customer, so change items reference to:



                items="${c.customerProfileVO}">






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 25 '18 at 6:38









                user7294900user7294900

                21.7k113258




                21.7k113258






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463882%2fjavax-servlet-jsp-jsptagexception-dont-know-how-to-iterate-over-supplied-item%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Contact image not getting when fetch all contact list from iPhone by CNContact

                    count number of partitions of a set with n elements into k subsets

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks