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

Components: "id" parameter is deleted

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.16.1
    • 2.3.20
    • Plugin - Tags
    • None

    Description

      When using <s:component> tag, parameter named "id" is not accessible in component. That seems to be due to UIBean.populateComponentHtmlId() method which always overwrites it with value of attribute named "id", even if id attribute has not been specified.

      For example, here is a call to a test JSP component:

      <s:component template="TestComponent.jsp">
      	<s:param name="id" value="'testIdValue'"/>
      	<s:param name="test" value="'testTestValue'"/>
      </s:component>
      

      If TestComponent.jsp, parameters.test will have value "testTestValue" and parameters.id will be null although it's expected to be "testIdValue".

      I think that it's due to method populateComponentHtmlId(Form form) in org.apache.struts2.components.UIBean class that always does this, at the end of the method body:

      addParameter("id", tryId);
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            bphillips Bruce Allen Phillips
            w.ghafir@ictjob.be Walid Ghafir
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment