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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:13:21+00:00 2026-05-30T23:13:21+00:00

I have followed reply from BalusC to resolve my problem How do I make

  • 0

I have followed reply from BalusC to resolve my problem

How do I make a Java ResultSet available in my jsp?

Now, when I run page.jsp, i am getting this error

org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'name' not readable on type java.lang.String

Please can you advise a solution.

i have followed below as well with no luck.

javax.el.PropertyNotFoundException: using JSTL in JSP

page.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.util.List"%>  
<!DOCTYPE html>  
<html>  
    <head>  
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
        <title>JSP Page</title>  
    </head>  
    <body>  
    <c:forEach items="${rows}" var="row">
 <c:out value="${row.name}" />
 </c:forEach>
<c:if test="${not empty error}">Error: ${error}</c:if>

    </body>  
</html>  

Controller.java

public class Controller extends HttpServlet {


protected void doGet(HttpServletRequest request, HttpServletResponse response) 

throws ServletException, IOException {

try {
    List<Row> rows = Row.list();
    //request.getSession().setAttribute("rows", rows);
    request.setAttribute("rows", rows);
 } catch (SQLException e) {
    request.setAttribute("error", "Retrieving rows failed.");
    e.printStackTrace();
}

 catch (Exception e) {
    e.printStackTrace();
}
finally {System.out.print("servlet");}
request.getRequestDispatcher("page.jsp").forward(request, response);
}
}

Row.java

import javax.naming.*;
import javax.sql.*;

import java.sql.*;
import java.util.ArrayList;
import java.util.List;

public class Row { 
    private String name;

private String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public static List<Row> list() throws SQLException {
    Connection connection = null;
    Statement statement = null;
    ResultSet resultSet = null;
    List<Row> rows = new ArrayList<Row>();

    try {
        Context initCtx = new InitialContext();
        Context envCtx = (Context) initCtx.lookup("java:comp/env");
        DataSource ds = (DataSource)
          envCtx.lookup("jdbc/TestDB");
         connection = ds.getConnection();
        statement = connection.createStatement();
        resultSet = statement.executeQuery("select id, name from account");
        while (resultSet.next()) {
            Row row = new Row();
            row.setName(resultSet.getString("name"));
            rows.add(row);
        }
    } catch(Exception e) {
        e.printStackTrace();
    }

    finally {
        if (resultSet != null) try { resultSet.close(); } 
 catch (SQLException logOrIgnore) {}
        if (statement != null) try { statement.close(); } 
 catch (SQLException logOrIgnore) {}
        if (connection != null) try { connection.close(); } 
 catch (SQLException logOrIgnore) {}
    }

    return rows;
}
}

Many Thanks
Muhammad

  • 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-30T23:13:22+00:00Added an answer on May 30, 2026 at 11:13 pm

    Your getter is private

    private String getName() {
        return name;
    }
    

    It is not visible

    Change it to public

    public String getName() {
        return name;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed the sample code on the Twilio github page and it doesn't
I have followed this tutorial: http://www.phpjabbers.com/how-to-make-a-php-calendar-php26-6.html#comments to make a very basic calendar. My aim
I have followed the instructions from this SO question: How to change the text
i have followed GridView in my ASP.Net Page: http://s2.imgimg.de/uploads/14b706b38JPG.jpg It should look like this:
I am trying to learn Ruby on Rails, I have followed the instructions from
Have followed every step correctly from this link http://msdn.microsoft.com/en-us/library/ms746621.aspx When trying to localize the
I have followed the onTouch example from google located here . However, I get
I have followed thenewbostons java game tutorials on youtube and managed to create a
I have followed the tutorial at http://blog.boreal-kiss.net/2011/03/15/how-to-create-universal-static-libraries-on-xcode-4/ To make myself a static library. It
I have followed the article here http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ I now have a working interceptor for

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.