12 March 2010

Using Stripes custom checkbox jsp tag

Stripes is an excellent, lightweight Java web MVC which just works with minimum effort... well most of the time. I got stuck recently when trying to use the stripes checkbox tag and I found the stripes checkbox javacdoc slightly ambiguous. This is how it's done...

The Stripes checkbox name value should map to an attribute on the view's corrosponding ActionBean. Ensure this attribute follows the standard JavaBeans specification (getters/setters) so Stripes can use it. All standard stuff so far, it's the next bit which confused me. Within your Jsp checkbox tag the checked value must MATCH the ActionBeans at tribute's value which is specified in the name value. Here's an example:

public MyActionBean extends ActionBean{

private boolean checkedValue;

public Resolution view(){
checkedValue = true
return new ForwardResolution(/myactionbean/view.jsp);


No comments:

Post a Comment