Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulating a table based on values chosen from a drop down in struts2 application
    primarykey
    data
    text
    <p>I have a drop down in a jsp page having the following code</p> <pre><code>&lt;s:select name="newQuestion.CertificationId" list="certificationList" listKey="certificationId" listValue="certificationName" headerKey="" headerValue="Select Certification" label="Certification Name" onchange="getQuestionsList(this.value)" /&gt; </code></pre> <p>Now the on change event of the drop down is calling a JS function getQuestionsList() which intends to fetch the question list of the certification Id choosen.</p> <p>In the JS function I am submitting it to a action class where I am doing a DB call to fetch question list based on values of certification Id</p> <pre><code>function getQuestionDetails(value){ var submiturl = "Action1.action?certId="+value; $.ajax({ url:submiturl, type: 'get', beforeSend: function(){ $("#loading").show(); alert("parsed"); }, success: function(result){ if(result!=''){ } else { alert(result); } }, }); } </code></pre> <p>Now in the action class I am setting the value of questionList with values I fetch from database .questionList is a instance variable in action class with getter and setter methods.Now in struts.xml I am passing to the same jsp where I had the drop down</p> <pre><code>&lt;action name="questionAction" class="questionInfo.QuestionManager" method="displaySelectedQuestions"&gt; &lt;result name="loaded"&gt;/questionAdmin.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>The problem I encounter is when I go back to the jsp I am not able to retrieve the question List which I display in an iterator </p> <pre><code>&lt;table class="registrationDetailsTable"&gt; &lt;tr class="tabledataheader"&gt; &lt;td&gt;Question Id&lt;/td&gt; &lt;td&gt;Question Description&lt;/td&gt; &lt;/tr&gt; &lt;s:iterator value="questionList"&gt; &lt;tr class="tabledatarow"&gt; &lt;td&gt;&lt;s:property value="questionId" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="questionDesc" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/s:iterator&gt; &lt;/table&gt; </code></pre> <p>Please let me know where I am getting wrong so that I have the question List populated in my jsp</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.
 

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