Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-178

LinkTag/RequestUtils.computeParameters - no longer supports non-String bean properties as parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Nightly Build
    • 1.0.0
    • Core
    • None
    • Operating System: All
      Platform: PC
    • 1719

    Description

      The recent change to LinkTag.java which calls RequestUtils.computeParameters
      breaks code that used to work. When using single value parameters with an
      html:link, if the bean property from which the link parameter is being pulled
      is not a String, an error occurs. It used to work if the bean property was a
      Long (or others). The error occurs in the following cast to a String. Should it
      be changed to do a toString() instead?

      // Add the single-value parameter (if any)
      if (paramId != null) {
      String paramValue = null;
      try

      { paramValue =(String) lookup(pageContext, paramName, paramProperty, paramScope); }

      catch (ClassCastException e)

      { saveException(pageContext, e); throw new JspException (messages.getMessage("parameters.single", paramName, paramProperty, paramScope)); }

      catch (JspException e)

      { saveException(pageContext, e); throw e; }

      In the past:
      <html:link paramId="menuId" paramName="menu" paramProperty="menuId"
      page="/listMenu.do">

      That worked where "menu" represented a bean with a property public Long
      getMenuId().

      Attachments

        Activity

          People

            craigmcc Craig R. McClanahan
            hdeadman Hal Deadman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: