Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6211743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:23:29+00:00 2026-05-24T06:23:29+00:00

I am getting string objects instead of Person objects in my JSTL. Here is

  • 0

I am getting string objects instead of Person objects in my JSTL.

Here is the code in my .tag file:

 <%
List<Person> perList=(List<Person>)pageContext.getAttribute("myVehicles");
 HashMap<String, com.info.PersonInfo> personRatingsMap=(HashMap<String, com.info.PersonInfo>)pageContext.getAttribute("personsMap");
 com.info.PersonInfo rtg=null;
 int i=0;
 HashMap<String, Object> givenMap=null;
 String tempYear=null;

 for(Object obj : perList){
     Person currPer=(Person)obj;
     tempYear=currPer.getYear();
     rtg=personRatingsMap.get(tempYear);
     givenMap=mapValuePair.get(tempYear);
     if(givenMap!=null){
         currPer.getNameset().get("PER").put("fname",givenMap.get("Per_NAME").toString());
         currPer.getNameset().get("PER").put("lname",givenMap.get("PerL_NAME").toString());
         currPer.getIdset().get("PER").put("myid",givenMap.get("myid").toString());
         currPer.setYear(givenMap.get("YEAR").toString());

     }
     if(rtg !=null){
         currPer.setRating(rtg);
     }
     perList.set(i,currPer);
     i++;
 }

 pageContext.setAttribute("myPersons",perList);

%>

<c:forEach items="myPersons" var="perFromList">
    <crp:getModelDefaultPhoto var="defaultPhoto"
    makeid="${perID}" modelid="${perIID}" 
    year="${perFromList.year}" />
<c:if test="${!empty defaultPhoto.value and defaultPhoto.value != ''}"> 
<c:set target="${photomap}" property="${perFromList.year}" value="${defaultPhoto.name},${defaultPhoto.value}" />
</c:if>

</c:forEach>

I am getting this error:

Unable to find a value for “year” in object of class
“java.lang.String” using operator “.”

Blockquote

So clearly the foreach loop is returning String instead of Person object because when I put System.out.println code in my scriptlet each Peson has the Year associated with it in the foreach It is considering person as String not the Person object.

I will really appreciate any help on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:23:29+00:00Added an answer on May 24, 2026 at 6:23 am

    It should be

    <c:forEach items="${myPersons}" var="perFromList">
    

    not

    <c:forEach items="myPersons" var="perFromList">
    

    Without the ${...}, you’re just operating off the String "myPersons", rather than the list that myPersons represents.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following Jackson/Java code that serializes objects into JSON, I am getting this:
My last question was about getting the string representation of an object serialized to
Im getting a string (simplified) from the backend that should be : { menu:
I am getting a string hash like this: string content = a very long
I'm going to try to explain the problem. I am getting a string containing
Hay.. I am facing a problem, I am getting a string 'strData' which contain
I am getting back a string[] from a 3rd party library. I want to
I'm getting this json string info from the server : {members:[[sd2840d,Johny],[jkld341,Marry]]} So I store
I'm having a problem with getting a Ruby string substitution going. I'm writing a
The XML String I am getting from other application is converting & to &amp;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.