What is the different between:
jsp:setProperty
inside jsp:useBean
tag, and jsp:setProperty
outside the jsp:useBean
tag? Some example code:
<jsp:useBean id="user" class="beans.User" scope="session" >
</jsp:useBean>
<jsp:setProperty property="email" name="user" value="programmingtute.com"/>
<jsp:setProperty property="password" name="user" value="abcdf"/>
<jsp:useBean id="user" class="beans.User" scope="session" >
<jsp:setProperty property="email" name="user" value="programmingtute.com"/>
<jsp:setProperty property="password" name="user" value="abcdf"/>
</jsp:useBean>
1.<:jsp:setProperty> can appear is inside the body of a jsp:useBean element. In this case it executed only if a new object was instantiated, not if an existing one was found.
2.<:jsp:setProperty> can appear is outside and after a jsp:useBean element. In this case it executed on a new object or any found existing bean created earlier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.