Name was not previously introduced" indicates that you haven't told your JSP about this bean as of yet.
您需要添加
<jsp:useBean id="taskBean" scope="request" />
在使用之前访问属性
jsp:getProperty
也,
的“名称”属性
jsp:getProperty应与声明的Bean的“ id”属性匹配。
然后访问
<jsp:getProperty name="taskBean" property="multiplier" />
使用scriptlet时
TaskBean taskBean = (TaskBean) request.getAttribute("taskBean");检查您是否已经
<%@page import="com.mybean.TaskBean"%>在JSP中添加了statemement。
因此,当JSP页面像一样被编译时
RequestScope_jsp.java。
首先,它具有bean的import语句。其次,
_jspService方法具有
request和
response参数作为参数。
_jspService(HttpServletRequest request, HttpServletResponse response)
因此,您可以使用转发的JSP页面访问它们
scriptlets。发生相同的事情
EL。
Remember thumb rule
:当您使用来访问bean属性时
jsp:getProperty,您需要添加
<jsp:useBean>用于查找和实例化bean类的属性



