aspose file tools*
The moose likes Spring and the fly likes Spring MVC + JqPlot Chart Data Retreiving error  - Chart not loaded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring MVC + JqPlot Chart Data Retreiving error  - Chart not loaded" Watch "Spring MVC + JqPlot Chart Data Retreiving error  - Chart not loaded" New topic
Author

Spring MVC + JqPlot Chart Data Retreiving error - Chart not loaded

priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
My Spring Controller class looks like this



In my jsp i handle response like this. (seems issue in here ??)



* Array should be



- But i got it like this




Grid class shows below

Here shows my MapTable Class



contactService.fin(); Method called to Service Classes & finally it in DAO classes.
Data also correctly come like above i mentioned array.here is my DAO class





Line Chart X & Y Axis & Background also load now.but data Line not shown there
please assist


Priyanka Kulathilaka
Software Engineer - Java
Sri Lanka
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

So what is your error? Is there an error message?

The only thing I see different from what you expected in the List to what you have is just the Time is missing. Maybe the Date object you are using doesn't support time, or you have a DateTimeFormat object that is removing the time.

I personally have never used JqPlot, so I wouldn't be able to help you on that side of the code.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Mark Spritzler wrote:So what is your error? Is there an error message?

The only thing I see different from what you expected in the List to what you have is just the Time is missing. Maybe the Date object you are using doesn't support time, or you have a DateTimeFormat object that is removing the time.

I personally have never used JqPlot, so I wouldn't be able to help you on that side of the code.

Mark


I have edited my question now
please check that again & assist for solve that issue
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

OK, first a comment. In your controller you have a signature of

List showLineChart(Map<String, Object> map,
HttpServletRequest request, HttpServletResponse response)

Why are you passing in the request and response. You don't need to pass those arguments, especially since you never use them. Even if you did @RequestParam is better to have Spring go into the request for you. Anyway.

So to me looks like you are getting the data that you want back out of the Controller. I see no difference between

* Array should be
var line1=[['2008-09-30 4:00PM',4], ['2008-10-30 4:00PM',6.5], ['2008-11-30 4:00PM',5.7], ['2008-12-30 4:00PM',9]];


- But i got it like this
[["2012-10-01",15.0],["2012-10-02",20.0],["2012-10-03",25.0],["2012-10-04",18.0],["2012-10-05",22.0],["2012-10-06",24.0]]

And you don't bother telling us what the difference would be, just expecting us to guess. Please tell us what is different there. Again the Time is the only difference and I commented on that before.

It sounds like your chart tool is the problem and that it seems to be on the client JavaScript side, so this might not even be the forum you need.

Please give us more detail.

Thanks

Mark
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Mark Spritzler wrote:OK, first a comment. In your controller you have a signature of

List showLineChart(Map<String, Object> map,
HttpServletRequest request, HttpServletResponse response)

Why are you passing in the request and response. You don't need to pass those arguments, especially since you never use them. Even if you did @RequestParam is better to have Spring go into the request for you. Anyway.

So to me looks like you are getting the data that you want back out of the Controller. I see no difference between

* Array should be
var line1=[['2008-09-30 4:00PM',4], ['2008-10-30 4:00PM',6.5], ['2008-11-30 4:00PM',5.7], ['2008-12-30 4:00PM',9]];


- But i got it like this
[["2012-10-01",15.0],["2012-10-02",20.0],["2012-10-03",25.0],["2012-10-04",18.0],["2012-10-05",22.0],["2012-10-06",24.0]]

And you don't bother telling us what the difference would be, just expecting us to guess. Please tell us what is different there. Again the Time is the only difference and I commented on that before.

It sounds like your chart tool is the problem and that it seems to be on the client JavaScript side, so this might not even be the forum you need.

Please give us more detail.

Thanks

Mark


thanks dear Mark Spritzler
now its solved.for other's use i posted it in my blog also

springjquery.blogspot.com
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Cool. Glad you got it solved. Wish I could have been more help to get it solved quicker.

So what was the issue and the solution? I checked out your blog post and it was just all code no text explaining it.

Mark
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Mark Spritzler wrote:Cool. Glad you got it solved. Wish I could have been more help to get it solved quicker.

So what was the issue and the solution? I checked out your blog post and it was just all code no text explaining it.

Mark


here i'm going to return list by ResponseBody.but i solved it like this.
i return array object.

check contoller class in here & my blog
check the difference

thanks again for your feedback

:-)
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

OK. so the chart wanted the data in a format that List was not giving you but Object[] did. Very interesting. I would think that they would return the same json with @ResponseBody. I wonder why it didn't

Thanks for posting.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring MVC + JqPlot Chart Data Retreiving error - Chart not loaded