This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error,using dynamic attributes in my Tag Handler class  RSS feed

 
Nirvikalp Rao
Greenhorn
Posts: 27
Java
  • Mark post as helpful
  • send pies
  • 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??
 
Mansukhdeep Thind
Ranch Hand
Posts: 1163
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 1163
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 1163
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!