我己配置好jrun4来运行jsp程序。在一般下工作正常,但每当要用到javabean时就出现关于(classpath)问题。我将编译好后的sampleBean.class放在此目录下面:
E:\JRun4\servers\myjsp\default-ear\default-war\WEB-INF\classes\bean
而运行的jsp在此目录下:
E:\JRun4\servers\myjsp\default-ear\default-war\jspfile\
但运行sample1.jsp就出现问题。
samplebean.jave源文件主要如下:
package bean;
public class sampleBean
{
private String sample = "Start value";
public String getSample() {
return sample;
}
public void setSample(String newValue) {
if(newValue != null) {
sample = newValue;
}
}
}而sample1.jsp源文件如下:
<%@ page contentType="text/html;charset=GBK"%>
<html>
<head>
<title>Servlet使用JSP</title>
</head>
<jsp:useBean id="myBean" 
scope="application" class="bean.sampleBean"/>
<body bgcolor="gray">
<h2>JSP使用JavaBean的例子:</h2>
<hr>
调用jsp:setProperty之前的值:
<jsp:getProperty name="myBean" property="sample"/>
<p>
<jsp:setProperty name="myBean" 
property="sample" value="hhhhhhhhhhhhh"/>
调用jsp:setProperty之后的值:
<jsp:getProperty name="myBean1" property="sample"/>
</body>
</html>
请问为什么?谢谢