O'Reilly logo

J2EE™ Tutorial, The by Beth Stearns, Monica Pawlan, Eric Jendrock, Kim Haase, Dale Green, Stephanie Bodoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting JavaBeans Component Properties

There are two ways to set JavaBeans component properties in a JSP page: with the jsp:setProperty element or with a scriptlet

<% beanName.setPropName(value); %> 

The syntax of the jsp:setProperty element depends on the source of the property value. Table 12-1 summarizes the various ways to set a property of a JavaBeans component using the jsp:setProperty element.

Table 12-1. Setting JavaBeans Component Properties
Value Source Element Syntax
String constant <jsp:setPropertyname="beanName "property="propName " value="string constant "/>
Request parameter <jsp:setPropertyname="beanName "property="propName " param="paramName "/>
Request parameter name matches bean property <jsp:setProperty name="beanName

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required