1 package hanqi;
2
3 public class XS
4 {
5 private String xm;
6 private String xb;
7 private int nl;
8 private String bj;
9 public String getXm() {
10 return xm;
11 }
12 public void setXm(String xm) {
13 this.xm = xm;
14 }
15 public String getXb() {
16 return xb;
17 }
18 public void setXb(String xb) {
19 this.xb = xb;
20 }
21 public int getNl() {
22 return nl;
23 }
24 public void setNl(int nl) {
25 this.nl = nl;
26 }
27 public String getBj() {
28 return bj;
29 }
30 public void setBj(String bj) {
31 this.bj = bj;
32 }
33 public XS(String xm,String xb,int nl,String bj)
34 {
35 this.xm=xm;
36 this.xb=xb;
37 this.nl=nl;
38 this.bj=bj;
39 }
40 }
1 <%@page import="hanqi.XS"%>
2 <%@ page language="java" contentType="text/html; charset=UTF-8"
3 pageEncoding="UTF-8"%>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <html>
6 <head>
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8 <title>Insert title here</title>
9 </head>
10 <body>
11 <%
12 XS xs=new XS("小明","男",18,"三班");
13 out.print("姓名:"+xs.getXm()+"<br>性别:"+xs.getXb()+"<br>年龄:"+xs.getNl()+"<br>班级:"+xs.getBj());
14 %>
15
16 </body>
17 </html>
![]()