输出学生信息javabean

输出学生信息:

package com.hanqi.test;

public class Student {

    private String sname;
    private int snum;
    private String zhuanye;
    public String getSname() {
        return sname;
    }
    public void setSname(String sname) {
        this.sname = sname;
    }
    public int getSnum() {
        return snum;
    }
    public void setSnum(int snum) {
        this.snum = snum;
    }
    public String getZhuanye() {
        return zhuanye;
    }
    public void setZhuanye(String zhuanye) {
        this.zhuanye = zhuanye;
    }
    
    
    
    
    
    
    
    
}
<%@page import="com.hanqi.test.Student"%>
<%@ 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>
<%
Student  s1=new Student();
s1.setSname("张三");
s1.setSnum(200913666);
s1.setZhuanye("计算机");

out.print("姓名:"+s1.getSname()+"<br>学号:"+s1.getSnum()+"<br>专业:"+s1.getZhuanye()+"<br>");

Student  s2=new Student();
s2.setSname("李四");
s2.setSnum(200913888);
s2.setZhuanye("会计");

out.print("姓名:"+s2.getSname()+"<br>学号:"+s2.getSnum()+"<br>专业:"+s2.getZhuanye()+"<br>");




%>
</body>
</html>

运行结果:

posted @ 2016-07-01 09:01  鱼在我这里  阅读(443)  评论(0编辑  收藏  举报