aspose file tools*
The moose likes JSP and the fly likes [%@ attribute name= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "[%@ attribute name="class" required="false" %] causes failure" Watch "[%@ attribute name="class" required="false" %] causes failure" New topic
Author

[%@ attribute name="class" required="false" %] causes failure

Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
If I use <%@ attribute name="class" required="false" %> in a JSP Tag file, it results in a blank page and the following error in my Tomcat console:



Any idea why? Change the attribute to "cssClass" works, but "class" is much more intuitive for web developers using my tag.

As a workaround, I can use dynamic-attributes. I'm just curious if this issue is documented anywhere or I'm just doing something wrong.

Thanks,

Matt
[ August 24, 2007: Message edited by: Bear Bibeault ]

Matt<br /> <br />Author: <a href="http://springlive.com" target="_blank" rel="nofollow">Spring Live</a> and <a href="http://www.apress.com/book/bookDisplay.html?bID=256" target="_blank" rel="nofollow">Pro JSP</a><br />Weblogs: <a href="http://raibledesigns.com" target="_blank" rel="nofollow">Raible Designs</a> <a href="http://jroller.com/page/raible" target="_blank" rel="nofollow">Spring Live Blog</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

I suspect that Tomcat could be dealing with the problem a bit better, but using an attribute or property name of class is going to get you in all sorts of trouble with conflicts with the getClass() method of Object.

In similar situations, I've used styleClass, but cssClass should work as well.
[ August 24, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [%@ attribute name="class" required="false" %] causes failure