Monday, 23 September 2013

jsp:getProperty action

defn:
Gets property values of a Bean object.
Syntax:
<jsp:getProperty name="{beanInstanceName}" property="{propertyName">
It is used to get the property values of a bean and basically whatever value you put in the attribute for the jsp:useBean element would go in the name for jsp get property element.


<jsp:useBean id="userBean" //this element would goes to the jsp get property element
      scope="request"
      class="ub.UserBean"
     type="{package.class}"
     beanName=""{package.beanName}">
</jsp:useBean>

that is <jsp:getProperty name="userBean" property="{propertyName">
Basically saying that you want to set ceretain, you want to get bean values for this particular (ie: beanInstanceName ex: <jsp:getProperty name="{beanInstanceName}" property="{propertyName">)
And in property basically give whatever property name whatever value you want to , example it could be username and set you want to display on jsp page so the property would be username here.

Example program for getProperty tag
Next: <jsp:setProperty> http://improve-jsp.blogspot.in/2013/09/jsp-implicit-object-jspsetproperty.html

No comments:

Post a Comment