When a dsp:setvalue tag is rendered, it invokes the same methods as events processed from a form. This includes calling both the appropriate setX and handleX methods. For example, a JSP might contain the following tag:

<dsp:setvalue bean="/test/Person1.name" value="Frank"/>

When this tag is encountered during page rendition, the following actions occur:

This process is the same as when property values are set from a form input tag.

You can use this technique with a form handler to set up aspects of the form before it is displayed and handled. For example, you might want to display the form only to users who are over the age of 13. You can write a handleAge method for your form handler that returns false if the user is under 13. The page might contain something like this:

<dsp:setvalue bean="MyFormHandler.age" paramvalue="currentUser.age"/>

<dsp:form action=...>

In this example, before the form is displayed, the setvalue statement sets the value of the form handler’s age property to the value of the currentUser.age parameter. (Presumably, this parameter is set from information stored when the user registered.) Setting the age property causes the form handler’s handleAge method to be invoked. If age is less than 13, this method returns false, and the rest of the page (including the form) is not rendered. If age is 13 or greater, handleAge returns true, and the rest of the page is rendered.