Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are several ways of achieving this. Since you are using JSP, the easiest would be to leverage the Java bindings in JSP.</p> <p>do the following: 1) in your JSP, include dojo and supporting files (stylesheets, dojo.js and dojo.requires for the grid)</p> <p>2) create a java variable in the request/jsp or session that stores the data that you want to render in the grid. You can use google gson or similar library to convert Java objects to JSON</p> <p>3) create a dojo datastore (such as an itemfilereadstore) by binding it to the java object that holds the data. For example:</p> <pre><code> &lt;% //you can also use a Java object/collectin and converted to json string using libraries such as Gson String gridData = "{ identifier:"id", items: [ {id:1, "Name":915,"IpAddress":6}, {id:2, "Name":916,"IpAddress":6}, {id:3, "Name":917,"IpAddress":6} ] }"; %&gt; var gridStore = new dojo.data.ItemFileReadStore( { data: dojo.fromJson(&lt;%= gridData %&gt;)} ); var gridStructure = var gridStructure =[{ cells:[ [ { field: "Name", name: "Name", width: "40%", styles: 'text-align: right;' }, { field: "IpAddress", name: "Ip Address" , width: "40%", styles: 'text-align: right;' } ] ] }]; </code></pre> <p>4) create the datagrid by specifying the layout and use the store you created in step 3 to populate the grid</p> <pre><code> &lt;div jsid="mygrid" id="mygrid" dojoType="dojox.grid.DataGrid" gridOptions='{query:"" ,structure:gridStructure,store:gridStore}' title="Simple Grid" style="width: 500px; height: 150px;"&gt;&lt;/div&gt; </code></pre> <p>Alternately, if you want to be more SOA-ish, you can use your jsp/Java EE backend as a service that returns JSON, and use plain HTML for rendering (and use AJAX to fetch the JSON from the Java EE backend)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload