Getting the request parameters in getProperty action:

1) We can get individual request parameters like,
<jsp:setProperty name=”employee” property=”empname” value=<%=request.getParameter(“empname”)%>/>

2)You can also do the same as above by using the param attribute.
<jsp:setProperty name=”employee” property=”empname” param=“empname”/>

3)You can do also in a better way,
Your form input field name must be same as in your bean. Then just specify the property but do not specify a value or param then the container will get the value from request parameters with a matching name.
<jsp:setProperty name=”employee” property=”empname”/>
The container will find the values but remember the form input field name must be same as bean property name.

4)You can use a asteric(*) when all the request parameter names match the bean property names.
<jsp:setProperty name=”employee” property=”*”/>

No comments:

Post a Comment