天天看点

编写一个封装学生信息的JavaBean对象,在jsp页面中调用该对象,并将学生信息输出到页面中。...

package come.hanqi.test;

public class XsBean {
private String name;
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public String getBanj() {
    return banj;
}
public void setBanj(String banj) {
    this.banj = banj;
}
public String getXueh() {
    return xueh;
}
public void setXueh(String xueh) {
    this.xueh = xueh;
}
public String getXingb() {
    return xingb;
}
public void setXingb(String xingb) {
    this.xingb = xingb;
}
private String banj;
private String xueh;
private String xingb;

}      
<%@page import="come.hanqi.test.XsBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% XsBean xb=new XsBean();
xb.setBanj("6年级1班");
xb.setName("张扬");
xb.setXingb("男");
xb.setXueh("201205404555");
out.print("学生信息");
out.print("<br>姓名:"+xb.getName());
out.print("<br>班级:"+xb.getBanj());
out.print("<br>性别:"+xb.getXingb());
out.print("<br>学号:"+xb.getXueh());
%>


</body>
</html>      
编写一个封装学生信息的JavaBean对象,在jsp页面中调用该对象,并将学生信息输出到页面中。...

转载于:https://www.cnblogs.com/jskbk/p/5627406.html