Thursday 19 January 2017

What is the jsp:setProperty action? What is the jsp:getProperty action? What is the standard action?

What is the jsp:setProperty action?
You use jsp:setProperty to give values to properties of beans that have been referenced earlier. You can do this in two contexts. First, you can use jsp:setProperty after, but outside of, a jsp:useBean element, as below:
<jsp:useBean id="myName" ... />
...
<jsp:setProperty name="myName" property="myProperty" ... />
In this case, the jsp:setProperty is executed regardless of whether a new bean was instantiated or an existing bean was found.

A second context in which jsp:setProperty can appear is inside the body of a jsp:useBean element, as below:
<jsp:useBean id="myName" ... >
  ...
  <jsp:setProperty name="myName"
                   property="someProperty" ... />
</jsp:useBean>
Here, the jsp:setProperty is executed only if a new object was instantiated, not if an existing one was found.

What is the jsp:getProperty action?
The <jsp:getProperty> action is used to access the properties of a bean that was set using the <jsp:setProperty> action.The syntax of the <jsp:getProperty> method is:

<jsp:getProperty name="Name" property="Property" />

What is the <jsp:param> standard action?
The <jsp:param> standard action is used with <jsp:include> or <jsp:forward> to pass parameter names and values to the target resource. The syntax of the <jsp:param> standard action is as follows:
<jsp:param name="paramName" value="paramValue"/>

No comments:

Post a Comment