码迷,mamicode.com
首页 > 编程语言 > 详细

jsp-javabean练习1

时间:2016-07-01 01:07:52      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

 

 

 1 package javaBean;
 2 
 3 public class JavaB2 {
 4     private String name="lhy";
 5     private int xuehao=123;
 6     private String banji="一年级一班";
 7     public String getname()
 8     {
 9         return name;
10     }
11     public void setname(String name)
12     {
13         this.name=name;
14     }
15     public int getxuehao()
16     {
17         return xuehao;
18     }
19     public void setxuehao(int xuehao)
20     {
21         this.xuehao=xuehao;
22     }
23     public String getbanji()
24     {
25         return banji;
26     }
27     public void setbanji(String baji)
28     {
29         this.banji=banji;
30     }
31 }
 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
 2     pageEncoding="UTF-8"%>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 4 <html>
 5 <head>
 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 7 <title>Insert title here</title>
 8 </head>
 9 <body>
10 <form action="javabean2.jsp" mothod="post">
11 <br>
12 用户名<input type="text" name="username">
13 <br>
14 密码&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="password">
15 <br>
16 <input type="submit" value="登录">
17 </form>
18 </body>
19 </html>
 1 <%@page import="javaBean.JavaB2"%>
 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 <%
13 JavaB2 jb2=new JavaB2();
14 out.print("姓名:"+jb2.getname());
15 out.print("<br>"+"学号:"+jb2.getxuehao());
16 out.print("<br>"+"班级:"+jb2.getbanji());
17 %>
18 </body>
19 </html>

技术分享

技术分享

jsp-javabean练习1

标签:

原文地址:http://www.cnblogs.com/yg6405816/p/5631585.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!