什么是等效的“servlet 代码”:
<jsp:useBean id="user" class="beans.UserBean" scope="session"/>
<jsp:setProperty name="user" property="*"/>
Tomcat 将其翻译为:
beans.UserBean user = null;
synchronized (session) {
user = (beans.UserBean) _jspx_page_context.getAttribute("user", PageContext.SESSION_SCOPE);
if (user == null) {
user = new beans.UserBean();
_jspx_page_context.setAttribute("user", user, PageContext.SESSION_SCOPE);
}
}
org.apache.jasper.runtime.JspRuntimeLibrary.introspect(_jspx_page_context.findAttribute("user"), request);
没有其他方法可以轻松做到这一点吗?