• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error,using dynamic attributes in my Tag Handler class

 
Greenhorn
Posts: 27
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use the following tag handler class, but when I deploy the app on my apache-tomcat
got the error :

/index.jsp (line: 13, column: 3) The mine:myselect tag declares that it accepts dynamic attributes but does not implement the required interface




My handler class is :



I am having a custom.tld in my WEB-INF directory:





And the Jsp, which uses this custom tag is:



In my WEB-INF directory, I have jstl.jar, standard.jar
What could possibly go wrong??
 
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this article on how to use a user defined tag library in your web application.



uri should point to the tag library descriptor file not the tag itself.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mansukhdeep Thind wrote:uri should point to the tag library descriptor file not the tag itself.


Wrong! Very wrong!

The uri in the declaration should match the uri declared in the TLD, whihc it does. This is not the problem and following this advice would simply create new problems.

I would, however, use real a real URI value that follows the proper format.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then why is it unable to recognize the tag if he has used the correct name given against the uri mentioned in his tld? Also, do you mean that the guy is wrong in this post this article? Or have I interpreted it wrongly? He has clearly given the path to the tld as in his jsp. I observed that that was the difference and drew this conclusion.

I would, however, use real a real URI value that follows the proper format.



What is a real uri value Bear?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a fallback that only works if the primary mechanism fails. It is a poor practice because it relies upon the physical location of the file on disk.

Best practice is to create a unique URI, following the formatting rule of a URI, and you can place the tag library in any of the legal locations, including in jar files.

Best practices are called "best" practices because they work, and because they prevent fragility. Just because you can get something to work, doesn't mean it's right.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mansukhdeep Thind wrote:What is a real uri value Bear?


A real URI follows the rule of a URL. That way it contains a unique domain that makes sure that there are no collision with URIs created by other organization.

For example ralph is a poor URIl; anyone can create a URI named ralph. And if you try to use libraries (or other things identified by URI) by these two people, you run into a problem because they are both named ralph.

But let's say I'm going to create a URI. I own the domain bibeault.org, so no one else should ever use that domain in a URI. So if I create a tag library for the ralph project, instead of naming it ralph, I'd name it: http://bibeault.org//taglib/ralph

No one else can make a URI containing bibeault.org (unless they are being malicious, in which case, don't use their products), so there can never be a name collision on that URI.

Again, best practices exist for a reason. They're not just arbitrary stuff that someone made up. They're create and shared because they solve problems that many people have run into. Ignore them at your own risk.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:That is a fallback that only works if the primary mechanism fails. It is a poor practice because it relies upon the physical location of the file on disk.

Best practice is to create a unique URI, following the formatting rule of a URI, and you can place the tag library in any of the legal locations, including in jar files.

Best practices are called "best" practices because they work, and because they prevent fragility. Just because you can get something to work, doesn't mean it's right.



Thank you for this advice. Will keep in mind.
 
Nirvikalp Rao
Greenhorn
Posts: 27
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks bear,Mansukhdeep. I got my problem solved. Now i know ,what should be kept in mind while naming URI. But that was not the issue in my case.
reply
    Bookmark Topic Watch Topic
  • New Topic