java - How to access List of List of Beans in Javascript -


i'm using raphael charts jsf 2.1. i'm trying draw linechart takes input x-axis array of arrays , y-axis. x-axis should contain timestamps(xvals in xhtml) , y-axis should containing avgval(avgbpsvals in xhtml). how can access tbean instance variables dt, avgval in javascript? ui:repeat gives me result beans.

    class inputbean{     private list<list<tbean>> results;     private list<tbean> result; private string resultjson;     //getters , setters private string getresultjson(){ gson gson = new gson(); return gson.tojson(results); }     }  class tbean{ private timestamp dt; private long avgval; //getters , setters } 

in sample.xhtml

    <?xml version='1.0' encoding='utf-8' ?>     <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml"         xmlns:ui="http://java.sun.com/jsf/facelets"         xmlns:f="http://java.sun.com/jsf/core"         xmlns:h="http://java.sun.com/jsf/html"         xmlns:p="http://primefaces.org/ui">     <f:view contenttype="text/html">     <h:head>     <script type="text/javascript" src="/resources/js/raphael.js"></script>             <script type="text/javascript" src="/resources/js/g.raphael.js"></script>             <script type="text/javascript" src="/resources/js/g.line.js"></script>             <script type="text/javascript" charset="utf-8">     window.onload = function() {                     var r = raphael("holder", 1000, 1000);     var results = #{inputtableplot.resultjson};  for(var i=0; &lt; results.length; i++)                 {                     for(var j=0; j &lt; results[i].length; j++)                     {                         alert("j : " + j);                         alert("value: " + results[i][j].avgval);                     }                 }                     var lines = r.linechart(40, 30, 900, 900, xvals,                             avgbpsvals, {                                 smooth : true,                                 symbol : 'circle',                                 axis : "0 0 1 1"                             });                     };      </script>     </h:head>     <h:body>     <h:panelgroup id="holder" layout="block"></h:panelgroup>     </h:body>     </f:view>     </html> 


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -