Oops! JSP+Java Bean Quick Start!
eclipse europa + tomcat 5.5
Purpose:
完成这个项目,能够对使用jsp + javabean
Prerequisite:
eclipse-java-europa-win32.zip
apache-tomcat-5.5.23.exe
tomcatPluginV31.zip
Reference:
http://www.blogjava.net/pixysoft/archive/2007/08/29/141048.html
Chapter 01
新建一个Dynamic Web Project, 名字叫Oops_JSP_Javabean
在src目录下建立一个count目录,增加一个java文件
counter.java
package count;
public class counter{
int count=0;
public counter(){}
public int getCount(){
count++;
return count;
}
public void setCount(int count){
this.count=count;}
}
在WebContent下面增加一个文件
counter.jsp
<html>
<body>
<jsp:useBean id="bean0" scope="application" class="count.counter"/>
<%
out.println("The Counter is : "+ bean0.getCount() +"<br>");
%>
</body>
</html>
右键点击项目,run as – server
在浏览器输入:
刷新几次能够看见变化!
posted on 2007-08-30 14:17
张辰 阅读(267)
评论(0) 编辑 收藏 所属分类:
Dr. Oops