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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:26:07+00:00 2026-05-23T16:26:07+00:00

I have a servlet application that takes the user input from HTML form ,

  • 0

I have a servlet application that takes the user input from HTML form , extracts the required data from backend and makes graphs/charts and shows them to user.
The problem I am seeing is that if user selects first option from dropdown, everything works fine, the data is extracted from backend – I can see it in the AJAX response in firebug and then its parsed by json and then maps are created.
The data that is received from backend is (what I see in AJAX response):

{"responseStr":"[47.636597,-122.189495,0,1,47.643647,-122.212038,0,26,47.505288,-122.339112,0,1,47.622741,-122.314592,0,60,47.541612,-122.129318,0,1,47.568435,-122.161237,0,166,47.682308,-122.196004,0,2,47.666673,-122.284099,0,1,47.612953,-122.316700,0,2,47.600605,-122.322286,0,30,47.589557,-122.315608,0,27,47.636351,-122.327213,0,1,47.630270,-122.177084,2,0,47.630432,-122.140126,17,0,47.621644,-122.132080,1,3,47.630808,-122.153539,86,75,47.622367,-122.337023,495,3466,47.630886,-122.306255,1423,45,47.720287,-122.090885,255,82,47.702376,-122.093340,47,4,47.676897,-122.318752,1,0,47.760994,-122.322550,1,2,47.588854,-122.221273,1,0,39.530179,-119.818395,1,1,47.631306,-122.342762,1,0,47.737242,-122.323710,1,0,47.747054,-122.305083,2,0,47.752018,-122.316452,1,0]"}

This is then parsed in json via

function Respond(REQ){
  var res = JSON.parse(REQ.responseText);
  var myArr = JSON.parse(res.responseStr);
  //forward myArr for processing
}

Now when the same user selects option 2, all works fine, the data is extracted from backend and I can see the following in the response

{"responseStr":"[00:00:00-01:00:00,100,30,0,01:00:00-02:00:00,100,29,0,02:00:00-03:00:00,100,34,0,03:00:00-04:00:00,100,5,0,04:00:00-05:00:00,100,7,0,05:00:00-06:00:00,100,23,0,06:00:00-07:00:00,78,29,0,07:00:00-08:00:00,48,17,0,08:00:00-09:00:00,24,35,0,09:00:00-10:00:00,18,29,0,10:00:00-11:00:00,5,28,0,11:00:00-12:00:00,45,57,0,12:00:00-13:00:00,65,69,0,13:00:00-14:00:00,64,58,0,14:00:00-15:00:00,73,46,0,15:00:00-16:00:00,72,27,0,16:00:00-17:00:00,94,9,0,17:00:00-18:00:00,69,15,0,18:00:00-19:00:00,14,9,0,19:00:00-20:00:00,25,13,0,20:00:00-21:00:00,81,38,0,21:00:00-22:00:00,53,74,0,22:00:00-23:00:00,76,55,0,23:00:00-24:00:00,89,16,0]"}

but when it comes to parse this via

function Respond(REQ){
   var res = JSON.parse(REQ.responseText);       
   var myArr = JSON.parse(res.responseStr);
   //forward myArr for processing

}
something wrong happens at line 2 of the function and hence user does not see a chart.
If I were to put alerts in Respond function,

function Respond(REQ){
   var res = JSON.parse(REQ.responseText);       
   alert('here');
   var myArr = JSON.parse(res.responseStr);
   alert('here2');
   //forward myArr for processing
}

then I do see first alert, but not the second. However, for the first case, i see both the alerts. So there is definitely something wrong on line 2. Can someone identify this by looking at the AJAX reponse?

  • 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-23T16:26:08+00:00Added an answer on May 23, 2026 at 4:26 pm

    Allrit, so in order to make the above a valid string, each of the 00:00:00-01:00:00 (similar ) strings should be enclosed in double quotes. So at a place in my servlet that was fetching this data from database, earlier I was doing

    resultSet.getString(1); 
    

    now I changed it to

    "\"" +  resultSet.getString(1)+ "\"";
    

    and it works.

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

Sidebar

Related Questions

I have a servlet based application that is serving images from files stored locally.
I'm working on an application. I have a servlet (writeDataBase.class) that writes some information
I have memory leak in the web application (servlet) that I am working on.
We have JSF web application that generates XLS file and gives user link to
I have a simple hello, world servlet application that I am just playing around
I'm developing a java servlet web application that manages information from multiple databases (all
i have some web based application that creates a zip file when user asks
I have a class that takes a bit of time to start up (makes
I have a servlet that allows users to download (potentially large) zip files from
I have an application that uses html5 to let the user listen to some

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.