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 7171547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:26:10+00:00 2026-05-28T15:26:10+00:00

I am trying to use the struts iterator to write some data from a

  • 0

I am trying to use the struts iterator to write some data from a List. Student is a class I have defined.
The s:property when used with the value attribute does not seem to work at all.

I have the following code in the JSP:

<s:iterator value="students" var="student">
    <h2><s:property /></h2>
    <h2><s:property value="firstName" /></h2>
    <h2><s:property value="student.firstName" /></h2>
    <h2><s:property value="top.firstName" /></h2>
    <h2><s:property value="[0].firstName" /></h2>
    <h2><s:property value="#firstName" /></h2>
</s:iterator>  

On the first property tag works. It prints the toString() of the Student object. All other property tags do not print anything at all.

The toString() method of Student class is as follows:

public String toString() {
    return firstName + " " + lastName + " " + Integer.valueOf(age);
}

The Student class has the getFirstName() method as follows:

String getFirstName() {
    return firstName;
}  

I am using Struts 2.1.6
There are no exceptions in the log files.
When viewing source of html, I just see the empty h2 tags.
I wonder what is the issue here. Any help is appreciated.

  • 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-28T15:26:10+00:00Added an answer on May 28, 2026 at 3:26 pm

    Your getFirstName() method only has package-level access. It should be public to be accessible from the JSP.

    change it to

    public String getFirstName()

    and you’re set.

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

Sidebar

Related Questions

I am trying to create a table to display some data using iterator over
I'm new to some Java technologies; I'm trying to use a combination of struts,
I'm trying to use Struts validation to check various fields entered by users. If
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use an excpetion class which could provide location reference for XML parsing,
Trying to use GnuPG with Delphi (Win32). I need to sign some file with
I'm trying to use Struts 2 framework for my Google App Engine project. I
I am trying to use Doxygen Automatic link generation to document some enum types.
I'm trying to use stl sort() in a class function. I would like to
I am trying to use marshalling in C#. In C++ I have a this

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.