scope= "request" "page" "session" "application" (对应四个隐含对象)
<jsp:userBean id="user"
scope="request"
class=""/>
<%= user%><br>
<%= request.getAttribute("user")%>
和下面等价
User user = null;
user=request.getAttribute("user");
if(user==null){
user = new User();
request.setAttribute("user",user);
}
<%= user%><br>
<%= request.getAttribute("user")%>
时间: 2024-10-01 11:33:42