This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean setter methods........

 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1. If there is no setter method is defined for a bean property will it be an error. In the jsp if we try to set the property value using <jsp:setProperty> what will happen??

2. If the setter method is present and we are not setting the value by using <jsp:setProperty> or by other means, will the default values(for stings empty sting and for integers 0 like ........) are set for these properties?

Thanks in Advance,
 
Murali Mohan A
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-----------------------------------------------------------------------
If there is no setter method is defined for a bean property will it be an error. In the jsp if we try to set the property value using <jsp:setProperty> what will happen??
----------------------------------------------------------------------

For <jsp:setProperty> standard action,
Internally JSP implementation object puts code to call setter method on the specified bean and when it doesnt find the setter method definition,
it shouts a compile error

Murali
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer question 2, the default value will be however you defined the bean class.
For instance: (inside a class)
private String myValue1; // default is null
private String myValue2 = null; // default is also null
private String myValue3 = ""; // default is empty string
private String myValue4 = "study hard"; // default is study hard

// TODO create setter methods later
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Passing SCJP first should answer question 2 too
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic