Note that there are some explanatory texts on larger screens.

plurals
  1. POsend argument from jsp to struts2 action class's method
    primarykey
    data
    text
    <p>this is the continuation of the following 2 links .... due to I was unable to post any comments for these...</p> <blockquote> <p>1. <a href="https://stackoverflow.com/questions/6310367/populating-a-table-based-on-values-choosen-from-a-drop-down-in-struts2-applicati?answertab=oldest#tab-top">Populating a table based on values chosen from a drop down in struts2 application</a></p> </blockquote> <p><strong>and</strong></p> <blockquote> <p>2. <a href="https://stackoverflow.com/questions/6971559/struts2-parameter-to-javascript?answertab=active#tab-top">Struts2 parameter to javascript</a></p> </blockquote> <p>I too have the same scenario where i need to print a table based on the selected value from the drop down list, in my google search I got this page and I used suggestions here. But when I select a value in my drop down list I get on table printed and the page still staying in the same page without any updation and below is my code ...help me out in this...</p> <p><strong>javascript</strong></p> <pre><code>&lt;script type="text/javascript"&gt; function showAllocationStatusJavaScript(){ var batchURL1="&lt;s:property value="#batchURL"/&gt;"; $.ajax({ url:batchURL1, type: 'get', beforeSend: function(){ $("#loading").show(); alert("parsed"); }, success: function(result){ if(result!=''){ $('myTableWrapper').html(result); } else { alert(result); } }, }); } &lt;/script&gt; </code></pre> <p><strong>inside the jsp body</strong></p> <pre><code>&lt;s:select label="Select Batch" headerKey="-1" headerValue="Select a Batch..."list="%{#session.Batchs}" Value="batch" name="batch" onchange="showAllocationStatusJavaScript()" id="batch"/&gt; </code></pre> <p><strong>URL Tag</strong></p> <pre><code>&lt;s:url action="doShowAllocationStatus" var="batchURL"&gt;&lt;param value="%{batch}"/&gt;&lt;/s:url&gt; </code></pre> <p><strong>this the table to print my list</strong></p> <pre><code>&lt;div id="myTableWrapper"&gt; &lt;table align="center" border="2"&gt; &lt;tr&gt; &lt;th&gt;TAN&lt;/th&gt; &lt;th&gt;Curator&lt;/th&gt; &lt;th&gt;Curator Status&lt;/th&gt; &lt;th&gt;QC&lt;/th&gt; &lt;th&gt;QC Status&lt;/th&gt; &lt;/tr&gt; &lt;s:iterator value="allocationList" &gt; &lt;tr&gt; &lt;td&gt;&lt;s:property value="tan"/&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="curator"/&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="curator_status"/&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="qc"/&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="qc_status"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/s:iterator&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p><strong>struts.xml</strong></p> <pre><code> &lt;action name="doShowAllocationStatus" class="controller.AllocateTAN" method="showAllocationStatus" &gt; &lt;result name="success" type="dispatcher" &gt;Allocation.jsp&lt;/result&gt; </code></pre> <p><strong>AllocateTAN action class</strong></p> <pre><code>//Fields that hold data... private List&lt;BatchInfo&gt; allocationList =new ArrayList&lt;BatchInfo&gt;(); private String batch; private List&lt;String&gt; batchs = new ArrayList&lt;String&gt;(); private String TAN; private List&lt;String&gt; Tans = new ArrayList&lt;String&gt;(); private String user; private List&lt;String&gt; users = new ArrayList&lt;String&gt;(); //and all getters and setters.... ..... //variable used to access DataBase... CationDAO dao1 = new CationDAO() ; //flow 1.: making all details available for the allocate TAN page...when page page is loaded 1st time public String AllocatingTANpageDetails() throws SQLException{ Map&lt;String, Object&gt;session=ActionContext.getContext().getSession(); this.batchs=dao1.Batch_List(); session.put("Batchs", batchs); //Tans=dao1.Tan_list(getBatch()); this.users=dao1.Users_List(); session.put("users", users); return SUCCESS; } private void showTANlist(String Batch1) throws SQLException{ Map&lt;String, Object&gt;session=ActionContext.getContext().getSession(); Tans=dao1.Tan_list(Batch1); session.put("Tans", Tans); } //flow 2.: showing Allocation Status in Table form...in same page public String showAllocationStatus() throws SQLException { Map&lt;String, Object&gt;session=ActionContext.getContext().getSession(); //setBatch(batch_value); session.put("Batch",batch); showTANlist(batch); System.out.println("Processing Allocation List... "); this.allocationList=(List&lt;BatchInfo&gt;)dao1.status(batch); System.out.println("Finished..."); return SUCCESS; } //execute method form allocating a TAN for a user... public String execute(){ return SUCCESS; } </code></pre>
    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.
 

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