• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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).]
 
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.
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!