• 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

Exception while using attribute in tag file

 
Ranch Hand
Posts: 56
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 56
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
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
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: 56
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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
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: 56
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah right. I am using tomcat 5.0.16
Thanks anyway
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic