Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9225269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:32:10+00:00 2026-06-18T04:32:10+00:00

I have multiple fields of various types in a JSP page and one button.

  • 0

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.

Since I don’t know how many and what type of fields are present, I am giving dynamic id‘s to them. I am using Struts 2 tags in my JSP.

The issue is with the <s:select> tag: when I give scriplet within the id attribute, it displays the following error :

org.apache.jasper.JasperException: /success.jsp(83,12) quote symbol expected

<s:if test="%{#masterColDO.controlType=='dropdown'}">
    <s:select styleClass="login-textbox" 
                   style="width:130px"  
                    list="#masterColDO.validation"     
                    name="chngdColumnValues" 
                      id=<%="columnId" + count%> />
</s:if> 
<s:else>
    <input type=<s:property value="#masterColDO.controlType" /> 
          class="login-textbox " 
           name="chngdColumnValues" 
             id=<%="columnId" + count%> />
</s:else>

Javascript is as follows:

var addUpdateBtnId = document.getElementById('addUpdateBtnId');
addUpdateBtnId.value='Update';
addUpdateBtnId.onclick = function() {
    onClickUpdateBtn(rowIndex);
};
var selectedUpdateRow = xmlhttp.responseText.split(",");
for(var i = 0; i < selectedUpdateRow.length; i++){
    var columnElementId = "columnId"+i;
    document.getElementById(columnElementId).value = selectedUpdateRow[i];
}
document.getElementById("columnId"+(primaryKeyPos-1)).readOnly = true;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:32:11+00:00Added an answer on June 18, 2026 at 4:32 am

    Scriptlets are the old way of doing things, you should avoid writing Java code in JSP‘s at all;

    Struts2 helps you achieving the same goals using its tags and OGNL only.

    The <input /> part is working because you are injecting a scriptlet inside an HTML tag, that is allowed.

    The <s:select /> part is not working because you are injecting a scriptlet inside an Struts2 tag, that is not allowed.

    To make it work, you should use #attr syntax in OGNL to access the Java variables declared in Scriptlets and pushed by you in the Page Context, like this (completely untested):

    <%
        for (int counter=0;counter<myList.size();counter++) {
           // pushing it into the pageContext
           pageContext.setAttribute("counter",counter);
    %>
            <s:select cssClass="login-textbox" 
                      cssStyle="width:130px" 
                          list="#masterColDO.validation" 
                          name="chngdColumnValues"      
                            id="%{'columnId' + #attr['counter']}" />
    <%    
        }
    %>
    

    However, even if it’s technically possible, it is discouraged. You should use the pure Struts2 way for that, that would be the following:

    <s:iterator value="myList" status="ctr">
        <s:select cssClass="login-textbox" 
                  cssStyle="width:130px" 
                      list="#masterColDO.validation" 
                      name="chngdColumnValues" 
                        id="%{'columnId' + #ctr.index}" />
    </s:iterator>
    

    P.S: Struts tags doesn’t have any styleClass attribute; you can use cssClass and/or cssStyle;

    And, if controlType is a String, you should use .equals instead of ==: <s:if test="%{#masterColDO.controlType.equals('dropdown')}">.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple input fields on one page. Each input field have a text
I have multiple input fields on my page. I Regex them with a css
I have a form where I've got multiple text inputs for various timefields, each
We have a link table that can handle multiple types of object on one
I have multiple fields for social networking websites where users can enter their username
I have multiple input text fields grouped in divs: <div class=container0> <input class=containerItem0 name=containerItem[0][0]
I have a single product table with multiple fields which contain user evaluations of
i have a multiple amount of text fields, the amount of text fields is
I have a Custom Control that has multiple textbox fields and a checkbox contained
I have a report that is basically a form with multiple empty fields and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.