• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tag Libraries

 
Anasapurapu Lakshmi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I had written a tag library in which I am give the type of the file and the name of the file and my tag is supposed to create the path specific to the type and and display the file
Say for example an image the tag will be
<mytag ath FileType="image" FileName="save.gif" />
my tag handler when called from the jsp executes well when it is implemented in weblogic6.1
but when I am trying to run the same code in tomcat servlet engine then it gives the error saying that FileType does not have the setter method
Why is it so? Does tomcat have some specification of declaring tag variables beginning with small case. I tried it by changing the case it works but why is it so?
thanxs and regards
Lakshmi
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving this to JSP forum
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember, tags are JavaBeans, and tag attributes are mapped to JavaBean properties. The JavaBean method-naming patterns don't lend themselves well to property names that start with an upper-case character. After all, a property named "foo" has getters and setters "getFoo()" and "setFoo()"; how could you distinguish this from a "Foo" property? The JavaBeans specification (section 8.8) states that, when a JavaBean property name is inferred from its getter and setter methods, it is assumed to start with a lower-case character. It makes only one exception to this: names that start with two upper-case characters are left alone, so "getURL()" will refer to a property "URL".
The Weblogic server apparently gives you some extra leeway above and beyond the spec, accepting what is in fact a bug in your code. You should be able to use a BeanInfo class, if you wish, to override the inferred property name. However I've never tried out how well application servers support this.
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!