Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2407

AbstractOptions of Palette may cause an HTML error with illegal chars

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.3.6
    • 1.4.1
    • wicket-extensions
    • None
    • Win XP, embedded Jetty / JBOss

    Description

      We encountered a small problem in our Palette.
      Some of the values that were supposed to be in the choices (available and/or selected) had the '<' and '>' .
      Because of that the options weren't rendererd correctly.
      Looking at AbstractAction#onComponentTagBody I saw that it takes the value as it is and put it in the html:
      String value = getConverter(displayClass).convertToString(displayValue, getLocale());
      where displayValue is Object displayValue = renderer.getDisplayValue(choice);

      Example fix:
      In my code I overridden the getDisplayValue and getDisplayId of the renderer:
      IChoiceRenderer choiceRenderer = new ChoiceRenderer("getFieldName", "getFieldName") {
      private static final long serialVersionUID = 1L;

      @Override
      public Object getDisplayValue(Object object)

      { final String result = (String) super.getDisplayValue(object); return Strings.escapeMarkup(result, true, true).toString(); }

      @Override
      public String getIdValue(Object object, int index)

      { final String result = (String) super.getIdValue(object, index); return Strings.escapeMarkup(result, true, true).toString(); }

      };

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            egolan74 Eyal Golan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: