• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wsad and struts (peculiar forms problem)

 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • 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
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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: 258
  • Mark post as helpful
  • send pies
  • 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: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, i meant thanks merril
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic