配置好环境后(参见:http://blog.csdn.net/kingapex1/archive/2004/07/15/42050.aspx)
建如下目录以存放JavaBean的class: D:\JsgTest\WEB-INF\classes\count
count是class 要 packpage 的包
在count目录下建文件Man.java:
package count;
public class Man{
private String Name;
public Man(){
this.Name = "KingApex";
}
public void setName(String aName) {
this.Name=aName;
}
public String getName(){
return this.Name;
}
}
编译Man.java
在 D:\JsgTest\ 建aMan.jsp:
<html>
<body>
<jsp:useBean id="abean" scope="page" class="count.Man" />
<%
out.println(abean.getName());
%>
</body>
</html>
测试路径: