DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7411>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7411

BaseHandlerTag always writes the title and alt attribute out

           Summary: BaseHandlerTag always writes the title and alt attribute
                    out
           Product: Struts
           Version: 1.1 Beta 1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I'm using an ImgTag and getting the image name and alt text from the bundle. 
The image shows up, but when I hover over the image, it shows "???
en_US.null???". However, if I look at the HTML source, the alt attribute does 
properly contain the text from the bundle, but the title attribute contains 
the "???en_US.null???".

 I didn't provide anything to do with the title attribute in my JSP. When I 
looked at the BaseHandlerTag source, I noticed that the prepareStyles method 
never checks to see if the title attribute has been populated before calling 
the message method with a null value. Of course, the message method is not 
going to find null in the bundle, so it returns "???en_US.null???". Therefore, 
the title attribute gets written out to the HTML source and this is what's 
coming up when you hover over the image, not the alt.

I believe all that needs to be done to fix this is in the prepareStyles method, 
check the title property for null before calling the message method like this:

// Check that one or the other has a value
if ( (title != null && title.length() > 0) ||
     (titleKey != null && titleKey.length() > 0) ){
  value = message(title, titleKey);
  if (value != null) {
   styles.append(" title=\"");
   styles.append(value);
   styles.append("\"");
  }
}

This also needs to be done for the alt attribute right below the title code.

Chuck

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to