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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:23:37+00:00 2026-06-11T09:23:37+00:00

I am returning SQL Query result as a JSONArray to a JSP page. Now

  • 0

I am returning SQL Query result as a JSONArray to a JSP page. Now i want to show the data. I have written a code but it is working fine only for 23 objects in the JSONArray if JSONArray contains more the 23 object eval or JSON.parse function doesn’t work. Please let me know how to solve this problem.

Below is the JS code i have written to iterate over this JSONArray.

var data = '<%=(JSONArray) request.getAttribute("resultArray")%>';
data = eval("(" + data + ")");
$(document).ready(function() {
   var table = $('<table/>').appendTo($('#column'));

   var rows = $('<tr/>').appendTo(table);
    $.each(data, function(rowid, row) {
       var rows = $('<tr/>').appendTo(table);
       $.each(row, function(column, data) {
           ($('<td/>').text(data)).appendTo(rows);
       })}); 
});
  • 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-06-11T09:23:38+00:00Added an answer on June 11, 2026 at 9:23 am

    Just don’t let JSP print it as a JS string syntax within quotes (which obviously needs to be parsed in order to get a JS object). Get rid of those quotes. JSON is already in proper JS object syntax. That’s also all what “JSON” stands for.

    var data = <%=request.getAttribute("resultArray")%>;
    $(document).ready(function() {
        // ...
    });
    

    By the way, using scriptlets in JSP is a poor practice. If you’re on JSP 2.0 already (which is out for almost a decade already), just use EL.

    var data = ${resultArray};
    $(document).ready(function() {
        // ...
    });
    

    Note, also here, just don’t quote it. It becomes otherwise a JS string instead of a JS object.


    Unrelated to the concrete problem, is it absolutely necessary to introduce the extra JSON/jQuery step here? Why don’t you just use for example JSTL to let JSP generate the desired HTML in the server side instead of JS/jQuery in the client side?

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

Sidebar

Related Questions

I have a SQL Server stored procedure that is not returning any data when
Possible Duplicate: Linq help - Sql trace returns result, but datacontext returning null Question
I have a SQL query that is returning a table like the following: id
I am having trouble in returning data in php from an SQL query. here
I have this SQL table: CREATE TABLE DATA ( ID NUMBER NOT NULL, CODE
I have a query made using linq to SQL which result will be shown
I have a complicated query written on SQL Server 2000 which in part contains
My sql query is only returning the children of the parent I need it
I have an sql statement that currently is just returning all the end parent
I have an oracle sql query select distinct tab1.col1, tab2.col1 from table1 tab1 join

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.