This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60815
    
  65

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
 
Similar Threads
Custom JSP Tag - Unrequired-Fields not cleared
How to set up 2 web applicaion in an ear file?
Jsp translation error
Issues adding i18n Chinese support to existing Struts based code
Setting variables from tagfiles with "var-from-attribute"