• jsp-javabean练习1


     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>

  • 相关阅读:
    Hackerrank alien-flowers(数学公式)
    Hackerrank manasa-and-combinatorics(数学推导)
    Codeforces 314B(倍增)
    Codeforces Round #403(div 2)
    Mutual Training for Wannafly Union #6
    几道splay
    高数(A)下 第十章
    Bestcoder #92
    codevs1700 施工方案第二季
    poj2631
  • 原文地址:https://www.cnblogs.com/yg6405816/p/5631585.html
Copyright © 2020-2023  润新知