Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4987

Setting Struts2 <s:select> options Css Class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.17
    • 2.5.20, 6.0.0
    • Core Tags
    • None

    Description

      Hi

      I am working on an application that is built on struts 2.5.17. I have <s:select> tag with <optgroup> and <option>. I am trying to add cssClass to <options> under <optgroup>. I am trying to add css class to <option> using listCssClass attribute of <s:select> but it is not adding class to the <option>. Any help would be much appreciated.

      Here is code from my JSP:

      <s:select list="#\{'none':'-Select Template-'}" id="export-data" cssStyle="width:250px;" title="templateDesc" cssClass="templateType" onchange="adjustReportText()" name="templateID" listCssClass="templateType"> 
      
      <s:iterator value="\{SOME MAP WITH KEY AND LIST OF VALUES}" var="TG" status="stat"> 
      
      <s:optgroup label="%\{key}" list="%\{value}" listKey="templateId" listValue="templateName" ></s:optgroup> 
      
      </s:iterator> 
      
      </s:select>
      

       Initially we were working on struts 2.2.3 version and in that version, cssClass attribute populates the CSS Class for <option>, but in 2.5.17 neither cssClass is populated class to <option> nor listCssClass.

       

      Attachments

        1. select.ftl
          4 kB
          Muhammad Salman
        2. optgroup.ftl
          2 kB
          Muhammad Salman
        3. struts.log
          78 kB
          Muhammad Salman

        Issue Links

          Activity

            People

              aleksandr-m Aleksandr Mashchenko
              mfsalmani678 Muhammad Salman
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: