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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:46:13+00:00 2026-05-24T05:46:13+00:00

I am trying to display data from my database to a Jsp page using

  • 0

I am trying to display data from my database to a Jsp page using Hibernate with Struts 2. Although there is no error nothing gets displayed.

I tried to find a solution from other posts but could not.

This the action class.

public class viewDayReportAction extends ActionSupport {

private static final long serialVersionUID = 9149826260758390091L;

//DayReportPersistence is the class which maps the table in hibernate
private List<DayReportPersistence> dayReportsList;
public List<DayReportPersistence> getDayReportsList() {
    return dayReportsList;
}
public void setDayReportsList(List<DayReportPersistence> dayReportsList) {
    this.dayReportsList = dayReportsList;
}

private DayReportPersistence dayReport;
public DayReportPersistence getDayReport() {
    return dayReport;
}
public void setDayReport(DayReportPersistence dayReport) {
    this.dayReport = dayReport;
}

private DayReportQuery dayReportQuery;
public viewDayReportAction() {
    dayReportQuery=new DayReportQuery();
}

@Override
public String execute(){ 
    this.dayReportsList=dayReportQuery.list();
    System.out.println(dayReportsList);
    //this statement prints the following in the tomcat output screen
    //[Hibernate.DayReportPersistence@1974acd, Hibernate.DayReportPersistence@1afe8ef,
    //Hibernate.DayReportPersistence@1974acd, Hibernate.DayReportPersistence@1afe8ef]
    //there are four objects because 4 records were fetched from the table

    return "success";
}
}

This is dayReportQuery.java which executes the query and returns result

public class DayReportQuery {

public List<DayReportPersistence> list(){
    Session session = HibernateConnection.getSessionFactory().getCurrentSession();
    session.beginTransaction();
    List<DayReportPersistence> dayReportsList = null;
    try {
        dayReportsList = (List<DayReportPersistence>) session.createQuery(
            "from DayReportPersistence").list();
        session.getTransaction().commit();

    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        session.getTransaction().rollback();

    }
    return dayReportsList;
}
}

And this is my jsp page which should display the data

<table>
<s:iterator value="dayReportsList" var="dayReport">
    <tr>
        <td><s:property value="Customer_Code"/></td>
        <td><s:property value="Contact_Code"/></td>
        <td><s:property value="Employee_Code"/></td>
        <td><s:property value="Enquiry_Code"/></td>
        <td><s:property value="Stage"/></td>
        <td><s:property value="Type"/></td>
        <td><s:property value="Date"/></td>
    </tr>
</s:iterator>
</table>

I don’t understand what am I doing wrong.

  • 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-24T05:46:15+00:00Added an answer on May 24, 2026 at 5:46 am

    Make sure that your DayReportPersistence class have the correct getters and setters for the fields you are looking for (like Customer_Code, Contact_code, etc.)

    Also, I noticed that these are capitalized with underscores which is not typically the case for Java variables.

    <s:property value="Customer_Code"/> should be <s:property value="customerCode"/>

    and the getter in the DayReportPersistence classwould be getCustomerCode().

    Edit:
    Capitalization does matter. If your getter is getContact_Code() then you should refer to it as <s:property value="contact_Code"/>. Note the lower case letter ‘c’ in contact_Code

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

Sidebar

Related Questions

I'm trying to get data from database, and echo them on the page using
I'm getting error Not unique table/alias while trying to display data from MySQL database
i am trying to display data from a database to the text box and
I'm trying to display data from my database in a ListFragment. To do this,
I'm trying to load data from database and display it in table like here:
I am trying to fetch data from my database and when I display it
I'm trying to export XML data from a web page to a spreadsheet using
I am using a table to display data pulled from two database tables. I
I am trying to fetch data from the following database data: And display the
I've trying to display random data from the database example in my database i

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.