Form Beans
Home ] Up ] Reading Form Parameters ] Reading All Parameters ] [ Form Beans ]

 

 

One can also populate a Java Bean from request parameters:

  • A Java Bean is a Java class which uses private fields and has methods that follow the standard getFoo/setFoo method naming convention
  • A getFoo/setFoo method indicates the presence of a property named foo.

It is possible to automatically populate a Java class that follows these conventions from request parameters, when request parameter names match the class' property names.

It is easier to do this in Java Server Pages (JSPs) than in vanilla servlet code.  The Jakarta Commons package (http://jakarta.apache.org/commons/) contains classes that make it easier to build utilities to allow for such automatic request parameter to Java class property association.

 
The page was last updated February 19, 2008