File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception while using attribute in tag file

 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The moderator requests that you post your solution so that anyone else experiencing the same problem can benefit from it.
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah right. I am using tomcat 5.0.16
Thanks anyway
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic