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

inputtransferselect does not auto-select its elements

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 2.5.10
    • 2.5.12
    • Core Tags

    Description

      I assume that this is a bug though and I am using the tag correctly.

      I have been trying to use the inputtransferselect tag. I created the component in my form and it renders on the page fine. However the documentation link here states that it "Will auto-select all its elements upon its containing form submission." However based on my attempts this is not the case. You need to select each entry which is added for them to come through to the action.

      Ideally I'd post all of the code but I'll need to cut it down because it's corporate (hopefully that won't hide what's going wrong)

      Action class:

      public class MyAction implements Preparable
      {
        private List<String> myList= new ArrayList<>();
      
        public List<String> getMyList()
        {
          return this.dependants;
        }
      
        public void setMyList(List<String> pDependants)
        {
          this.dependants = pDependants;
        }
      
        @Override
        public void prepare() throws Exception
        {
          // Populates my list from session memory, this works fine...
        }
      
      @Override
        @Actions({
                @Action(
                        value = "/" + ActionPathConstants.SAVE,
                        interceptorRefs = @InterceptorRef(
                                value = "defaultSecurityStack",
                                params = {
                                        "tokenSession.includeMethods",
                                        "*" }),
                        results = {
                                @Result(
                                        type = "redirectAction",
                                        name = ActionPathConstants.SUCCESS,
                                        location = ActionPathConstants.NEXT_PAGE),
                                }) })
        public String save() throws Exception
        {
          // This maps the value of myList back to session memory
        }
      }
      

      JSP file:

      <s:form id="myPageSave" action="myPageSave" method="post">
        <s:inputtransferselect
                              label="myList"
                              name="myList"
                              addLabel="Add"
                              removeLabel="Remove"
                              removeAllLabel="Remove all"
                              allowUpDown="false"
                              leftTitle="Input item"
                              rightTitle="Existing items"
                              list="myList"
                       />
      </s:form>
      

      Note that the from is submitted via javascript. Rather than by directly pressing a submit button. Could this have any impact on how the auto select works?

      Attachments

        Activity

          People

            Unassigned Unassigned
            suipaste Stephe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: