permaculture playing cards*
The moose likes JSP and the fly likes Exception while using attribute in tag file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Exception while using attribute in tag file" Watch "Exception while using attribute in tag file" New topic
Author

Exception while using attribute in tag file

Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 36
Hello Folks,
I am using a JSP with the following code

This JSP declares and tries to use a tag file named "includeparam.tag" which is in the /WEB-INF/tags directory whose code is as given below
code of includeparam.tag:


While trying to view the JSP, i am getting the following exception:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JasperException: Unable to find setter method for attribute: custom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTE: Though I am able to see the page without any problem if I remove that attribute directive in the tag file and from the tag in the JSP.

I am running this on tomcat 5.0.16 with JSTL version 1.1
Please help me out by telling me whats the error and how do i correct it.

Thanks & Regards
Dinkar
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 36
Hello All,
I was able to identify the problem myself without waiting for a reply. So I request the moderator to delete this topic.

Thanks
Dinkar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

The moderator requests that you post your solution so that anyone else experiencing the same problem can benefit from it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 36
The problem was a very trivial one so I didnt care to post the solution. Anyway, the problem was that initially I had created the tag file without any attributes and called it without giving any attributes in the JSP.

Later I added an attribute "custom" to the tag file and provided the attribute in the call to the tag file in the JSP after which I got this exception.

It appears that the tag files are created as java classes in a folder called "tags" in the temporary working directory(the one used to generate java and class files for the JSPs). After I added the attribute, the container wasnt recompiling the tag files to create new versions of java and class files for it but it recompiled the JSP. So effectively, the JSP was passing the attribute but the old version of the compiled tag files didnt accept any attributes hence the exception "unable to find setter method".

Once I cleared the temporary folder and issued a fresh request, everything got compiled and it worked fine.

Hope this explanation is sufficient and helpful for beginners like me

In case I am not clear in whatever I just explained, kindly let me know. I'll be glad to help.

Regards
Dinkar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

I also noticed this problem (tag files not getting updated after a change) in Tomcat 5.0, so you're not going crazy. Is that what you are using? it seems to have been fixed in Tomcat 5.5.
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 36
Yeah right. I am using tomcat 5.0.16
Thanks anyway
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception while using attribute in tag file
 
Similar Threads
Problem While using EL
Tag files not working ...
JSP Tags - Attributes passed returns NULL [SOS Please help]
JSTL Tag File Attribute problem
Taglib uri..problem..(need help)