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

Conversion annotation ignored for ServletAction parameter

    XMLWordPrintableJSON

Details

    Description

      This definitely worked before 2.3.20, but unfortunately I haven’t been able to track down the actual source of the bug introduced for 2.3.20. My best guess is that it was introduced when the code was refactored to support Collections.

      Basically I have an Action, with a setter and getter for state that uses a custom type convertor like so:

          /** @return the state. */
          @TypeConversion(converter = "com.myco.typeconvertor.RegionTypeConvertor")
          public RegionI getState() {
              return state;
          }
      

      When I submit the action, this type convertor is correctly used to turn the “state” post parameter into a RegionI object which is injected into the Action. So far so good.

      However, the result looks like:

            <result name="selfSignupFlow" type="redirectAction">
               <param name="actionName">confirmAccount</param>
               <param name="streetAddress">${streetAddress}</param>
               <param name="city">${city}</param>
               <param name="state">${state}</param>
               <param name="postalCode">${postalCode}</param>
      	    ...
            </result>
      

      And in the latest release, when it evaluates ${state} it uses the default type convertor (in this case for an enum because the concrete class is a USState enum), rather than the com.myco.typeconvertor.RegionTypeConvertor specified on both the getter and setter for state in the action.

      Attachments

        Issue Links

          Activity

            People

              lukaszlenart Lukasz Lenart
              perfnorm Jasper Rosenberg
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: