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

Struts text tag displays incorrect default value when using the spring plugin

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.6
    • 2.3.1
    • None
    • JBoss 4.2.3 with JDK 1.6 on Windows XP. Struts 2.1.6. Spring 2.5.6.

    Description

      I first noticed the improper behavior in my own application, but I was able to reproduce the behavior by slightly modifying the Struts2 + Spring2 + JPA + AJAX tutorial.

      To reproduce the behavior:

      1st update the Struts2 + Spring2 + JPA + AJAX tutorial to use Struts 2.1.6. These changes are minimal, and are mostly just upgrading to the dojo plugin from the ajax theme.

      2nd, once the tutorial is working with 2.1.6, I added a single line to the index.jsp file.

      I added the line just before the closing body tag, but you can add it anywhere.
      <s:text name="does.not.appear.in.properties.file"><s:text name="also.does.not.appear.in.properties.file"/></s:text>

      When I run the jsp page, the text that is displayed is:
      does.not.appear.in.properties.file

      Neither of the keys in the two text tags above are in any resource. As I understand the documentation, and as I believe this worked in 2.0.14, the proper output should be:
      also.does.not.appear.in.properties.file

      As I understand the documentation, the first text tag should try to look up a value for the key "does.not.appear.in.properties.file". The lookup will not find a value for that key, so the tag should display the default value that is provided in the body of the tag. In this case, the body of the text tag is another text tag. This inner text tag should try to look up a value for the key "also.does.not.appear.in.properties.file". This lookup does not find a value either, but since there is no default value provided in the body of the inner text tag, the tag should display the key "also.does.not.appear.in.properties.file". This value should then be used as the default value for the outer text tag. However, instead of the outer text tag displaying this default value, it just displays its key "does.not.appear.in.properties.file".

      It doesn't seem to matter if the inner tag's lookup returns a value or not (it doesn't seem that the inner tag's lookup is even attempted). I haven't checked if providing a default value in the body of the outer text tag (but isn't itself a text tag, just some plain text) works properly, though that would probably be a helpful test.

      Also, I don't see any indication of the new TextProvider logging in my log files as outlined on http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html in the "TextProvider missing keys" section.

      Also, this doesn't seem to happen in the Blank tutorial.

      When I first noticed this issue, it was in my own application, which uses freemarker templates instead of jsps.

      Attachments

        Activity

          People

            Unassigned Unassigned
            khopkins Ken Hopkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: