日期:2014-05-18 浏览次数:20829 次
<%@ page contentType="text/html" pageEncoding="GBK"%>
<%@ page import="JavaBean.demo.*"%>
<html>
<head><title>JavaBean</title></head>
<body>
<%
Person p = new Person();
p.setName("hua");
p.setAge(12);
%>
<%=p.getName()%>
<%=p.getAge()%>
</body>
</html>
package javabean.demo;
public class Person{
private int age;
private String name;
public Person(){
System.out.println("-------新的人类------");
}
public void setAge(int age){
this.age = age;
}
public int getAge(){
return age;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
}