请教一问题啊。单独静态jsp 页面 可以调试成功:index.jsp上显示 This is a jsp page.但是如果jsp 页面上调用写的一个 hello类,就提示错误:
org.apache.jasper.JasperException: jsp:getProperty for bean with name 'hello'. Name was not previously introduced as per JSP.5.3
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1052)我的 hello 类很简单啊 :package com.test.bean;
public class Hello {
private String message = "Hello World";
public String getMessage()
{ return message;}
public void setMessage(String message)
{ this.message = message;}
}
index.jsp 页面就比默认的多补一行:
<body>
This is my JSP page. <br>
<jsp:getProperty name="hello" property="message" /><br> This is my new JSP page. <br>
</body>
org.apache.jasper.JasperException: jsp:getProperty for bean with name 'hello'. Name was not previously introduced as per JSP.5.3
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1052)我的 hello 类很简单啊 :package com.test.bean;
public class Hello {
private String message = "Hello World";
public String getMessage()
{ return message;}
public void setMessage(String message)
{ this.message = message;}
}
index.jsp 页面就比默认的多补一行:
<body>
This is my JSP page. <br>
<jsp:getProperty name="hello" property="message" /><br> This is my new JSP page. <br>
</body>
name="Hello"
<jsp:useBean id="hello" class="com.test.bean.Hello" scope="page|request|session|application其中一个"/>你没有useBean怎么能使用以下的语句呢,就相当于没有定义变量不能使用一样的
<jsp:getProperty name="hello" property="message" />这里的name="hello" 指向jsp:useBean id="hello" 定义的id变量hello
[code=Java]
request.setAttribute("message",hello.message);[
/code]
页面上${message}就可以了。
改成这样了,还是不行啊。提示错误有:
org.apache.jasper.JasperException: Unable to load class for JSP
就这么容易的一个界面,杂总是不成功。。伤心啊。