• 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

Cannot find a setter

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's time for another round of "Charessa has no idea what she's doing!"

Ok, so I'm calling this custom tag:



With this code in the .jsp file:


and Tomcat is telling me:

/detailview.jsp(32,4) Unable to find setter method for attribute: aUser



(line 32 of detailview.jsp corresponds with ]<inq:singleRec>)

soooo.. what did I miss this time?

edit: fixed the line the error was referring too, I copied the wrong line at first)
 
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
Why are you using <jsp:attribute> tags in the first place instead of just using standard attribute notation on the tag?
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just doing what I've learned. See the first line of my above post. Still very much learning.
 
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
What happens when you try the normal syntax?
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried calling it with this:

<inq:singleRec aUser="${user}" theID="${id}" />

and I got the same result. ${user} is a properly assigned field. If I take out the tag call and put in just ${user} it displays the variable's value.
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for kicks, I even tried switching the order of the declarations: and the error message remains the same.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I presume you have a methods getAUser() and setAUser().

My suggestion would be to try:


Check out the decapitilize method in java.beans.Introspector for an explanation.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefan Evans wrote:I presume you have a methods getAUser() and setAUser().



Ouch. It's the dreaded "setEMailAddress" problem!
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe I'm missing a fundamental principle of custom tags.

I thought <%@ attribute name="someName" required="true" %> was all the code I needed to write in a tag to create that attribute in the tag. The jsp container would then create the appropriate getter and setter for it when it compiled. Am I wrong? Do I need to go back to jsp kindergarten?
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's nothing to do with custom tags. Follow the link that Stefan provided (to the Introspector class) and read the full text describing the decapitalize() method. It's simply a quirk of the name you chose.
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
even though if I'm not using a bean?

ugh. hwo about I just make them all lower case. Will later maintainers hate me?
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's the same naming and capitalization conventions as for beans. The problem only arises when your property name (for a bean) or parameter name (in this case) starts with a lower-case character followed by an upper-case character, as in "eMail" (where I got burned by this) or as in "aUser" (your situation).

Why not just call the parameter "user"? Or if the "A" stands for something, like say "Abattoir" then spell that out?
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah, the "a" was just an indefinite article. I swapped the name out. And, actually, this helps with an issue in another issue in another area. So I'm glad I asked. Thanks for the help!
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. 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