Difference between HttpSession’s getSession(), getSession(true) and getSession(false) methods


  • getSession() : Returns the current session associated with this request, or if the request does not have a session, creates one.
  • getSession(true) : Returns the current HttpSession associated with this request, if there is no current session, returns a new session
  • getSession(false) : Returns the current HttpSession associated with this request, if there is no current session, returns null.

org.springframework.beans.NotReadablePropertyException: Invalid property


NotReadablePropertyException: Invalid property Exception

ERROR: org.springframework.web.servlet.tags.form.RadioButtonTag - Invalid property 'newUser' of bean class [com.malliktalksjava.bean.UserBean]: Bean property 'newUser' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
org.springframework.beans.NotReadablePropertyException: Invalid property 'newUser' of bean class [com.malliktalksjava.bean.UserBean]: Bean property 'newUser' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:725)
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:716)
at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)
at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:229)
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141)
at org.springframework.web.servlet.tags.form.AbstractCheckedElementTag.autogenerateId(AbstractCheckedElementTag.java:81)

Solution:

  • Ensure all the properties configured in the form are available in the FormBean object.
  • In the above case, radio button property have not been configured in the UserBean class.