Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts 2 s:select tag dynamic id
    primarykey
    data
    text
    <p>I have multiple fields of various types in a JSP page and one button. These fields are generated based on the info got from a metadata table that I have created.</p> <p>Since I don't know how many and what type of fields are present, <strong>I am giving dynamic <code>id</code>'s to them</strong>. I am using Struts 2 tags in my JSP.</p> <p>The issue is with the <code>&lt;s:select&gt;</code> tag: when I give scriplet within the <code>id</code> attribute, it displays the following error : </p> <blockquote> <p>org.apache.jasper.JasperException: /success.jsp(83,12) quote symbol expected</p> </blockquote> <pre class="lang-xml prettyprint-override"><code>&lt;s:if test="%{#masterColDO.controlType=='dropdown'}"&gt; &lt;s:select styleClass="login-textbox" style="width:130px" list="#masterColDO.validation" name="chngdColumnValues" id=&lt;%="columnId" + count%&gt; /&gt; &lt;/s:if&gt; &lt;s:else&gt; &lt;input type=&lt;s:property value="#masterColDO.controlType" /&gt; class="login-textbox " name="chngdColumnValues" id=&lt;%="columnId" + count%&gt; /&gt; &lt;/s:else&gt; </code></pre> <p>Javascript is as follows:</p> <pre class="lang-js prettyprint-override"><code>var addUpdateBtnId = document.getElementById('addUpdateBtnId'); addUpdateBtnId.value='Update'; addUpdateBtnId.onclick = function() { onClickUpdateBtn(rowIndex); }; var selectedUpdateRow = xmlhttp.responseText.split(","); for(var i = 0; i &lt; selectedUpdateRow.length; i++){ var columnElementId = "columnId"+i; document.getElementById(columnElementId).value = selectedUpdateRow[i]; } document.getElementById("columnId"+(primaryKeyPos-1)).readOnly = true; </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.
    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