• jsp7周作业


    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 'index.jsp' starting page</title>
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">    
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
      </head>
      
      <body>
        <form name="form1" method="post" action="control.jsp" >
            <table>
            <tr>    
                <td>编号:</td>
                    <td> <input type="text" name="sid" id="userName"  ></td>
                </tr>
                <tr>    
                    <td>用户名:</td>
                    <td> <input type="text" name="uname" id="userName"  ></td>
                </tr>
                <tr>    
                     <td>输入登录密码:</td>
                    <td><input type="password" name="upwd" id="pwd"></td>
                </tr>
                
                <tr>    
                    <td colspan="2"><input type="submit" value="注册"></td>
                </tr>
            </table>
        </form>
      </body>
    </html>
    package com;
    
    public class Stu {
        private int sid;
        private String uname;
        private String upwd;
        //访问器
        public int getSid() {
            return sid;
        }
        public void setSid(int sid) {
            this.sid = sid;
        }
        public String getUname() {
            return uname;
        }
        public void setUname(String uname) {
            this.uname = uname;
        }
        public String getUpwd() {
            return upwd;
        }
        public void setUpwd(String upwd) {
            this.upwd = upwd;
        }
        //构造器
        public Stu(int sid, String uname, String upwd) {
            super();
            this.sid = sid;
            this.uname = uname;
            this.upwd = upwd;
        }
        public Stu() {
            super();
        }
        
        
        
        
        
    
    }
    <%@page import="com.gd.dao.StuDao"%><%@page import="com.Stu"%><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%    Stu s = new Stu();        String uname = request.getParameter("uname");    s.setUname(uname);    String upwd = request.getParameter("upwd");    s.setUpwd(upwd);        StuDao sd=new StuDao();    if(sd.addStu(s)>0){        //跳转注册成功页面     }else{        //错误页面     }            %>
    <%@page import="com.gd.dao.StuDao"%>
    <%@page import="com.Stu"%>
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
        Stu s = new Stu();
        int id = Integer.parseInt(request.getParameter("sid"));
        s.setSid(id);
        String uname = request.getParameter("uname");
        s.setUname(uname);
        String upwd = request.getParameter("upwd");
        s.setUpwd(upwd);
        
        StuDao sd=new StuDao();
        if(sd.addStu(s)>0){
            //跳转注册成功页面 
        }else{
            //错误页面 
        }
        
        
        
    %>
  • 相关阅读:
    SqlServer卸载实例
    java写的各种钟(收集)
    Codeforces 1003D Coins and Queries 【性质】
    Codeforces 997B Roman Digits【暴力】【枚举】
    洛谷 P2679 子串 【dp神题】【滚动数组】【2015 noip d2t2】
    复习图论
    Codeforces 1000D Yet Another Problem On a Subsequence 【dp】【组合数学】
    Codeforces 1000C Covered Points Count 【前缀和优化】
    Codeforces 999F Cards and Joy 【dp】【性质】
    Codeforces 999D Equalize the Remainders 【模拟】
  • 原文地址:https://www.cnblogs.com/nanke-/p/14661990.html
Copyright © 2020-2023  润新知