How setProperty converts the values and set to the bean class?

Bean tags convert primitive properties automatically. In case of integer setProperty takes the value from input as string converts it to int and then passes to beans setter method.
All the below cases conversion works properly,
<jsp:setProperty name=”employee” property=”empname” param=“empno”/>
<jsp:setProperty name=”employee” property=”empno”/>
<jsp:setProperty name=”employee” property=”*”/>
<jsp:setProperty name=”employee” property=”name” value=”111”/>
But in the below case automatic conversion does not work. We have to do manually.
<jsp:setProperty name=”employee” property=”empname” value=<%=request.getParameter(“empname”)%>/>

No comments:

Post a Comment