Two ways to get/set Bean properties-which to use?

Discussions

Web tier: servlets, JSP, Web frameworks: Two ways to get/set Bean properties-which to use?

  1. Hi all,
    I'd like to know if there's any difference in setting Bean properties with <getProperty>/<setProperty> directives and calling directly the getter/setter methods of the bean (<% int x = mybean.getvalue(); %> ).
    Do they have different impact on the application/session ?
    Thanks in advance
    Francesco
  2. Nope, they work the same, other than the set and get accessors doing automatic type conversion to Strings. For example, if you had a String on a page, and did a setProperty on a double within a page bean, it would take the value of java.lang.Double.valueOf(String).