Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>you should define your action result <code>type="json"</code> and check you have json plugin on your classpath, make sure you have</p> <pre><code>&lt;struts&gt; &lt;package name="your_package" extends="struts-default, json default" namespace="/"&gt; // your action here &lt;/pacakge&gt; ... &lt;/struts&gt; </code></pre></li> <li><p>edit your action class like this</p> <pre><code>public class myAction extends ActionSupport { private List&lt;User&gt; userlist; // getter and setter public String execute() { // your moves return SUCCESS; } } </code></pre></li> <li><p>then you can do some on your jsp page to show the result like:</p> <pre><code>&lt;s:iterator list="userList"&gt; &lt;s:property value="username"/&gt; &lt;s:property value="password"/&gt; &lt;s:property value="createdDate"/&gt; &lt;s:iterator&gt; </code></pre></li> </ol> <p>I hope this can help you..</p> <p><strong>UPDATE</strong></p> <p>if you have already a json object:</p> <pre><code>{ "userList" : [ {"username" : "username", "password" : "afgasdfa", "createdDate" : "date-in-format"}, {"username" : "username", "password" : "afgasdfa", "createdDate" : "date-in-format"}, {"username" : "username", "password" : "afgasdfa", "createdDate" : "date-in-format"}, {"username" : "username", "password" : "afgasdfa", "createdDate" : "date-in-format"} ] } </code></pre> <p>this should be the format.</p> <p>then you should get this object from your action class with <code>List&lt;User&gt; userList</code></p> <p>just try it and feedback.</p> <p><strong>UPDATE 2</strong></p> <p>maybe you should get your json object using <code>String</code>, then convert it to Java Object using:</p> <pre><code>String stringObject; // which get your string from http List&lt;User&gt; userList; userList = (List&lt;User&gt;)JSON.deserialize(stringObject,List&lt;User&gt;.class); </code></pre> <p>Please feedback again.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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