Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with bean:define

 
Sandeep Ghosh
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am facing a strange problem . My form(bean) class has property whose type is long,but its getter method is returning String.In the JSP I am showing the value of that bean using

when I am running it is giving exception saying getter method of sessionTime is not found.
When I am changing the getter method to long it is running perfectly.
Does anybody has faced similer problem.I am using Tomcat 4.0.3 and struts1.1 .
Thanks in adv
[ April 28, 2005: Message edited by: Nataraj Ramesh ]
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tag <bean:define> is typically used to define scripting variables. My interpretation has always been that it should be used for run-time decisions, but I don't think this is spelled out anywhere. Most beans should be instantiated and placed into context (request, session, etc...) by an Action. If it is a form bean, it may be specified in the struts-config.xml, in which case the form bean will automatically be placed into context as appropriate. As a side note, form beans should only have properties which are String, booleans, other form beans, or Collections or arrays of Strings, booleans, and other form-beans.
As for your specific problem, does your bean have a method getSessionTime(), with the 'S' in "Session" capitalized? Assuming this is true, what happens if you change your internal representation of sessionTime from a long to a String?
[ January 19, 2003: Message edited by: Jason Menard ]
 
Sandeep Ghosh
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Same exception is given even if I capitalize the first character of property, but when I changed my JDK from 1.3 to 1.4.1 . it is working. Since we are not yet migrating to 1.4, I created some dummy getter methods which is returnning String and now it is working perfectly.
Is it problem of JDK 1.3 or something wrong with my code
Thanks in adv
Sonu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic