我试图使用jsp标记,如下所示,没有jsp:useBean标记。值在servlet中设置并转发给jsp:
request.setAttribute("person", p);在jsp中,试图获得值:
<jsp:getProperty name="person" property="title"/>有时它会得到值,有时它会抛出以下异常:
org.apache.jasper.JasperException: file:/index.jsp(17,0)
jsp:getProperty for bean with name 'person'.
Name was not previously introduced as per JSP.5.3请提出为什么这种行为是不可预测的?
发布于 2014-02-08 10:19:21
我想你是在使用tomcat6或者以后,对吧?
在调用jsp:useBean之前,尝试再次使用jsp:getProperty标记来引用bean。它可能会起作用:
<jsp:useBean id="person" class="xxx.xxx.Person" />
<jsp:getProperty name="person" property="title" />这可能是猫的臭虫。看看这个:bug.cgi?id=48701
https://stackoverflow.com/questions/21644682
复制相似问题