title: Using variables from Struts2 with ReactJS
body: <p>So here`s the deal. At my workplace, we are trying to introduce ReactJS components in our web app (JSP/Struts2 etc).</p>
  
  <p>So far I've built a component that is supposed to display a tree based on an object, here's a sample:</p>
  
  <pre><code>export default {
      name: 'Global',
      nodeid: 99,
      toggled: true,
      children: [
          {
              name: 'Mid Node',
              nodeid:  0,
              chosen: false,
              pushed: false,
              toggled: false,
              children: [
                  { name: 'Lower Node',
                    nodeid: 1,
                    chosen: false,
                    pushed: false,
                    toggled: false,
                    children: [{
                      name : "Low Child 1",
                      pushed: false,
                      toggled: false,
                      chosen:false
                    }]
                  }
              ]
          }
      ]
  };
  </code></pre>
  
  <p>What I want to do is receive this from a struts action response, rather than having it hard coded to a file which is what I did in my example.</p>
  
  <pre><code>import React from 'react';
  import TreeComponent from 'proj-1/TreeComponent';
  import HierarchyJson from './internal/Data';
  
  export default function ExampleTreeComponent() {
      return &lt;TreeComponent hierarchyJson={HierarchyJson} functionMode={2} htmlId="tree1"/&gt;
  }
  </code></pre>
  
  <p>I've seen a ton of posts where spring is used, but I don't know what are my options in this case. I don't want to have to write an AJAX call to get the data after my JSP page has already rendered.</p>