aspose file tools*
The moose likes Struts and the fly likes wsad and struts (peculiar forms problem) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "wsad and struts (peculiar forms problem)" Watch "wsad and struts (peculiar forms problem)" New topic
Author

wsad and struts (peculiar forms problem)

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
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

Joined: Oct 27, 2003
Posts: 258
sorry, i meant thanks merril
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wsad and struts (peculiar forms problem)