Child pages
  • Why does my setter not get called by the params interceptor

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Why doesn't my setter get called ?

Aaron Johnson had a problem with a setter for a property that never seemed to get called. He had a getter/setter combination that did not match:

Code Block
public void setUser(String username) {
    ...
}
public User getUser() {
    ...
}

The short answer is that your getter and setter must match the property type, or OGNL will not be able to call it (due to a reflection API semantics). You can read the full explanation here.