Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The correct solution is :</p> <p><strong>Struts.xml:</strong></p> <pre><code>&lt;result-types&gt; &lt;result-type name="json" class="org.apache.struts2.json.JSONResult" /&gt; &lt;/result-types&gt; &lt;action name="listUsers" method="getAllApplicationData" class="com.pilot.web.action.ListUsers"&gt; &lt;result name="success"&gt;/jsp/userList.jsp&lt;/result&gt; &lt;result name="input"&gt;/jsp/fail.jsp&lt;/result&gt; &lt;/action&gt; &lt;action name="getData" method="getAllApplicationData" class="com.pilot.web.action.ListUsers"&gt; &lt;result name="success" type="json"&gt;&lt;/result&gt; &lt;/action&gt; </code></pre> <p><strong>Index.jsp</strong></p> <pre><code>&lt;s:form action="/searchAndUpdate/listUsers" method="post"&gt; &lt;s:submit name="ListUsers" value="List All Users" align="right" /&gt; &lt;/s:form&gt; </code></pre> <p><strong>userList.jsp</strong></p> <pre><code>&lt;%@ page contentType="text/html; charset=UTF-8"%&gt; &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt; &lt;%@ taglib prefix="sj" uri="/struts-jquery-tags"%&gt; &lt;%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;sj:head jqueryui="true" jquerytheme="redmond"/&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;Application Users&lt;/h3&gt; &lt;s:actionerror/&gt; &lt;s:actionmessage/&gt; &lt;s:url id="remoteurl" action="/searchAndUpdate/getData"/&gt; &lt;sjg:grid id="gridtable" caption="Application Users" href="%{remoteurl}" pager="true" gridModel="gridModel" rowList="10,15,20" rowNum="15" rownumbers="true" resizable="true" viewrecords="true" name="gridModel" &gt; &lt;sjg:gridColumn name="id" index="id" title="Id" formatter="integer" sortable="false"/&gt; &lt;sjg:gridColumn name="userName" index="userName" title="User Name" sortable="true"/&gt; &lt;sjg:gridColumn name="fullName" index="fullName" title="Full Name" sortable="false"/&gt; &lt;sjg:gridColumn name="email" index="email" title="EMail" sortable="false"/&gt; &lt;/sjg:grid&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is a working code. Working perfectly fine :)</p> <p>The issue was : The jsp accepts data type json as an input &amp; the action ListUsers has to render a jsp. So, I made two different actions. One that returns "json" which serves as an input to the jsp &amp; one which renders the jsp on success.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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