• 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

wsad and struts (peculiar forms problem)

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Was having a hard time with this problem.

When I have form fields named in the format "firstName" and auto-generate getter+setter methods, they work fine.
Method Generated are:
getFirstName()
setFirstName()


However when i have a field name with the format "FirstName" and auto generate getter+setter methods, i get a servlet exception saying struts bean cannot find getter method for "FirstName".
Methods generated are :
getFirstName()
setFirstName()

I think this probably because the getter method struts calls is not the same format as generated by WSAD(or most other IDE/editors).
but do you have any idea about what the getter method would look like for
"FirstName"
(could you pls test it on your app )

thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Bean Utilities that Struts relies on (commons-beanutils.jar) assume that you have named your attributes according to standard Java naming practices, one of which is that attribute names start with a lower case character.

My advice: Save yourself a lot of grief and use the standard java naming practices.
 
Pranav Sharma
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks alan. did that. but i had done some scripting on the client side and it takes the field name strips any underscores and displays the name for any errors. I guess the user's can live with a "first name" instead of "First Name"
 
Pranav Sharma
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, i meant thanks merril
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic