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

Unable to set long pathname variables

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.24
    • Fix Version/s: 2.5.25, 2.6
    • Component/s: Core
    • Labels:
      None

      Description

       
      I implemented a simple struts2+tiles (Struts 2 core version: 2.3.24.1) as a test case to verify an issue that have.

      In detail, i have the following Struts form:

      <s:form action="save">
                  <s:hidden name="metadataTest.name" value="Level-1_new" />
                  <s:hidden name="metadataTest.metadataList[0].name" value="Level-2_new" />
                  <s:hidden name="metadataTest.metadataList[0].metadataList[0].name" value="Level-3_new" />
                  <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].name" value="Level-4_new" />
                  <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].metadataList[0].name" value="Level-5_new" />
                  <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].name" value="Level-6_new" />
                  <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].name" value="Level-7_new" />
                  <s:submit/>
       </s:form> 
      

      The metadataTest class:

      public class Metadata implements Serializable {
      
      /** The Constant serialVersionUID. */
      private static final long serialVersionUID = 5902230367443812176L;
      
      private String name;
      
      private ArrayList<Metadata> metadataList;
      
      public Metadata() {
      }
      
      public String getName() {
          return name;
      }
      
      public void setName(String name) {
          this.name = name;
      }
      
      public ArrayList<Metadata> getMetadataList() {
          return metadataList;
      }
      
      public void setMetadataList(ArrayList<Metadata> metadataList) {
          this.metadataList = metadataList;
      }
      }
      

      My issue here is following. When i submit this form, all values up to this level, are set correctly

      <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].name" value="Level-6_new" />
      

      For some reason the below hidden element is never set, instead, the medataList at level 6 is null, while the name set by the hidden field above, is set correctly.

      <s:hidden name="metadataTest.metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].metadataList[0].name" value="Level-7_new" />
      

      Is there any kind of limitation by struts concerning the depth in a list hierarchie or maybe the length of path to set a value ? I could not find something related.

      Note 1: It surely has to do something with the length of the parameters. Once i changed the variable names to longer ones, i was able to set values only up to Level 3.

      Note 2: Downgrading to Struts 2.1.6 resolves the issue. Also latest version 2.5.22 seems to be afffected from the exact same issue. Is there any workaround ?

       

        Attachments

        1. Struts2Sample.zip
          11 kB
          Stephan
        2. Struts2Sample2.zip
          10 kB
          Stephan

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              steph Stephan
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3.5h
                3.5h