title: How to convert Arraylist of objects to Javascript?
body: <p>Im using struts and javascript to show one table of elements, the method </p>
  
  <pre><code>public List&lt;Object&gt; preparaInformeRiesgoActivos( int dimension, String idTipoActivo, String idActivo, String tipoActivo, String nombreActivo, ResourceBundle recursos ) {
      // TO-DO: Cambiar query de else.
      String consulta = "";    
      if(dimension!=0){            
          consulta = "SELECT A.ID_AMENAZA, A.CODIGO, A.DENOMINACION, D.ID_RANGO, D.IMPACTO, D.RIESGO FROM (  SELECT ID_AMENAZA, ID_RANGO, SUM(IMPACTORESIDUAL) AS IMPACTO, SUM(RIESGORESIDUAL) AS RIESGO "
                  +  "FROM AGR_IMP_RISK_REAL WHERE ID_TIPOACTIVO="+idTipoActivo+" AND ID_ACTIVO='"+idActivo+"' and ID_RANGO = 7 "
                  +  "GROUP BY ID_AMENAZA, ID_RANGO) D , (  SELECT ID_AMENAZA, SUM(IMPACTORESIDUAL) AS IMPACTOTOTAL "
                  +  "FROM AGR_IMP_RISK_REAL WHERE ID_TIPOACTIVO="+idTipoActivo+" AND ID_ACTIVO='"+idActivo+"'  and ID_RANGO = 7 "
                  +  "GROUP BY ID_AMENAZA) T , AGR_AMENAZA A WHERE T.IMPACTOTOTAL&lt;&gt;0 AND T.ID_AMENAZA = D.ID_AMENAZA AND D.ID_AMENAZA = A.ID_AMENAZA ORDER BY D.ID_AMENAZA, D.ID_RANGO";
      }else{
          consulta = "SELECT A.ID_AMENAZA, A.CODIGO, A.DENOMINACION, D.ID_RANGO, D.IMPACTO, D.RIESGO FROM (  SELECT ID_AMENAZA, ID_RANGO, SUM(IMPACTORESIDUAL) AS IMPACTO, SUM(RIESGORESIDUAL) AS RIESGO "
                  +  "FROM AGR_IMP_RISK_REAL WHERE ID_TIPOACTIVO="+idTipoActivo+" AND ID_ACTIVO='"+idActivo+"' and ID_RANGO = 7 "
                  +  "GROUP BY ID_AMENAZA, ID_RANGO) D , (  SELECT ID_AMENAZA, SUM(IMPACTORESIDUAL) AS IMPACTOTOTAL "
                  +  "FROM AGR_IMP_RISK_REAL WHERE ID_TIPOACTIVO="+idTipoActivo+" AND ID_ACTIVO='"+idActivo+"'  and ID_RANGO = 7 "
                  +  "GROUP BY ID_AMENAZA) T , AGR_AMENAZA A WHERE T.IMPACTOTOTAL&lt;&gt;0 AND T.ID_AMENAZA = D.ID_AMENAZA AND D.ID_AMENAZA = A.ID_AMENAZA ORDER BY D.ID_AMENAZA, D.ID_RANGO";
      }
      Query q = dao.createNativeQuery(consulta);    
      List&lt;Object&gt; resultado = q.getResultList();    
      return resultado;
  }
  </code></pre>
  
  <p>This method returns a collections of objects. in my jsp im using ExtJS as framework to show one table with this elements. How i can convert my java Arraylist in one javascript store without frameworks (if is it possible)?</p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@page import="com.dominion.procop.agr.struts.forms.AGRInformesForm"%&gt;
  &lt;script type="text/javascript"&gt;
  Ext.onReady(function() {    
      var amenazaStore = Ext.create('Ext.data.Store', {
          model: 'Amenazas',
          data: [
              { id: 1, codigo: 'E.1', denominacion: 'Errores de los usuarios', id_rango: '0', impacto: '0', riesgo: '0'},
              { id: 2, codigo: 'E.5', denominacion: 'Deficiencias en la organización', id_rango: '0', impacto: '0', riesgo: '0'},
              { id: 3, codigo: 'E.8', denominacion: 'Escapes de información', id_rango: '0', impacto: '0', riesgo: '0'},
              { id: 4, codigo: 'E.9', denominacion: 'Alteración accidental de la información', id_rango: '0', impacto: '0', riesgo: '0'}
          ]
      });
  
  ...
  &lt;/script&gt;
  </code></pre>