I'm trying to use multiple attributes in my custom tag, e.g.:
<mytaglib:mytag firstname="Thadeus" lastname="Jones" />
How can I access the attributes in the TagHandler code?
I'm trying to use multiple attributes in my custom tag, e.g.:
<mytaglib:mytag firstname="Thadeus" lastname="Jones" />
How can I access the attributes in the TagHandler code?
Not really the answer to what you asked, but I hate (ie have never written) TagHandler's but I love tag files. Lets you write custom tags using jsp files. You probably know about them and are not available/applicable - but thought I'd mention them just in case.
To demonstrate the solution of this problem lets take an analogy . Suppose we have "userName" and "password" which is retrieved from index.jsp and we have to pass our data in custom tag attribute. In my case its working
In order to access the parameters your TagHandler class should define the private members and provide accessor methods.
you can then access the parameters through the TagHandler variables.
If you still have problems double check your naming conventions, the Java interpeter is trying to guess what the setter method is. So if your parameter is "FirstName" than the set method must be "setFirstName" if the parameter is "lastname" the set parameter must be "setlastname". I perfer to follow the former, since it is the standard Java naming convention.