Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000387 [Resin] minor always 09-16-05 00:00 11-30-05 14:42
Reporter user391 View Status public  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.0.15 Product Version 3.0.14
  Product Build 3.0.14
Summary 0000387: Cannot create JSP 2.0 .tag file with "class" attribute
Description RSN-433
Given the following JSP 2.0 tag file:

---
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" [^] %>
<%@ attribute name="url" required="true"%>
<%@ attribute name="class" required="false"%>
<%@ attribute name="width" required="false"%>
<%@ attribute name="height" required="false"%>

<c:if test="${empty width}"><c:set var="width" value="600"/></c:if>
<c:if test="${empty height}"><c:set var="height" value="400"/></c:if>

<a href="openPopup('${url}', 'popup', 'width=${width},height=${height},directories=no,location=no,menubar=no,status=no,toolbar=no')"><jsp:doBody/></a>
---

This will result in a compilation error because of the name of the attribute "class" which is a reserved word in Java:

<identifier> expected
  private java.lang.String class;

This is because names of attributes are copied verbatim as members of the implementing class. No check for reserved words is done. A solution would be to append a '_' to every member, but with proper setters:

public void setClass(String class_) {
    this.class_ = class_;
}

If I change the attribute name to "className" everything works as expected.
Steps To Reproduce
Additional Information Windows XP SP2, Java 1.5
Attached Files

- Relationships

- Notes
(0000445)
ferg
09-16-05 00:00

jsp/101f
 

- Issue History
Date Modified Username Field Change
09-16-05 00:00 user391 New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.15
11-30-05 14:42 ferg Status resolved => closed


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
33 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker