Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with jsp:setProperty ... (long mail)  RSS feed

 
John Bateman
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to process a form. It submits to itself, it's data is verified and it's forwarded to apropriate page/servlet.
The form 'names' I.E. <INPUT name=""> are the same name AND case as the PUBLIC set method in my dateBean.
So, an input field of name "Year" has the following specific information in my DateBean class.

If I do....

and then try displaying the info like so...

Everything is 'null' alternatively if I try displaying the info with the following...

Everything is still null.
And last but not least if I try populating the following way, and displaying in BOTH diffrent ways mentioned above...

I get the following error...

It will have no problem setting the year and then letting me print it out with <%= dateBean.getYear() %> but I can't use a getProperty to print it or I get that error message.
I have other 'beans' in my page (Multiple <jsp:useBean> i my page) and it's only a few of the beans that these problems happens. Most of the others seem fine.
Any suggestions?
------------------
SOURCE CODE should be SURROUNDED by "code" tags.
Click here for an example
[This message has been edited by John Bateman (edited May 01, 2001).]
 
Raghav Sam
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,
I have been having similar problems with Beans. No idea whats the prob. I use Tomcat 3.2.1. BTW, you have not mentioned what server you are using.

------------------
Raghav.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Bateman:
[B]So, an input field of name "Year" has the following specific information in my DateBean class.
[/B]

These are not getters and setter methods for a property called "Year"! These are getters and setters for a property called "year". In a JavaBean, the getter (setter) method of a property is "get" ("set") plus the property name with the first character capitalised. Try again, lower-casing the first character of all your properties. I'm sure it will work.
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!