zoukankan      html  css  js  c++  java
  • 进度八(10.26)

     

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
             160px;
            color: white;
            background-color: greenyellow;
        }
        .tb, td {
            border: 1px solid black;
            font-size: 22px;
        }
    </style>
    </head>
    <body>
        <div align="center">
            <h1 style="color: red;">征集表信息总览</h1>
            <table class="tb">
                <tr>
                    <td>技术需求名称</td>
                    <td>技术需求解决方式</td>
                    <td>科技活动类型</td>
                    <td>归口管理部门</td>
                    <td>所属机构</td>
                    <td>电子信箱</td>
                    <td>联系人</td>
                    <td>手机</td>
                    <td>审核状态</td>
                    <td>详情</td>
                    <td>修改</td>
                    <td>删除</td>
                </tr>
                <c:forEach items="${table}" var="item">
                    <tr>
                        <td>${item.jsxqmc}</td>
                        <td>${item.jsxqjjfs}</td>
                        <td>${item.kjhdlx}</td>
                        <td>${item.gkglbm}</td>
                        <td>${item.jgqc}</td>
                        <td>${item.dzxx}</td>
                        <td>${item.lxr}</td>
                        <td>${item.sj}</td>
                        <td>${item.status}</td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.wjid}">详情</a></td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.wjid}">修改</a></td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.wjid}">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </body>
    </html>
    View Code
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
             160px;
            color: white;
            background-color: greenyellow;
        }
        .tb, td {
            border: 1px solid black;
            font-size: 22px;
        }
    </style>
    </head>
    <body>
        <div align="center">
            <h1 style="color: red;">用户信息总览</h1>
            <table class="tb">
                <tr>
                    <td>昵称</td>
                    <td>姓名</td>
                    <td>性别</td>
                    <td>机构</td>
                    <td>权限</td>
                    <td>详情</td>
                    <td>修改</td>
                    <td>删除</td>
                </tr>
                <c:forEach items="${user}" var="item">
                    <tr>
                        <td>${item.username}</td>
                        <td>${item.name}</td>
                        <td>${item.sex}</td>
                        <td>${item.jgmc}</td>
                        <td>${item.power}</td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.id}">详情</a></td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.id}">修改</a></td>
                        <td><a href="AdminServlet?method=getCourseById&id=${item.id}">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </body>
    </html>
    View Code
    package servlet;
    
    import java.io.IOException;
    import java.util.List;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import bean.Table;
    import dao.AdminDao;
    
    @WebServlet("/AllTableServlet")
    public class AllTableServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        public AllTableServlet() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            request.setCharacterEncoding("utf-8");
            List<Table> table = AdminDao.listtable();
            request.setAttribute("table", table);
            request.getRequestDispatcher("admin/alltable.jsp").forward(request,response);
        }
    
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
    View Code
    package servlet;
    
    import java.io.IOException;
    import java.util.List;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import bean.User;
    import dao.AdminDao;
    
    @WebServlet("/AllUserServlet")
    public class AllUserServlet extends HttpServlet {
        
        private static final long serialVersionUID = 1L;
        
        public AllUserServlet() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            request.setCharacterEncoding("utf-8");
            List<User> user = AdminDao.listuser();
            request.setAttribute("user", user);
            request.getRequestDispatcher("admin/alluser.jsp").forward(request,response);
        }
    
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
    View Code
    package dao;
    
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.List;
    
    import bean.Table;
    import bean.User;
    import util.DBUtil;
    
    public class AdminDao {
        
        public static List<User> listuser() {
            String sql = "select * from t_user";
            List<User> list = new ArrayList<>();
            Connection conn = DBUtil.getConnection();
            Statement state = null;
            ResultSet rs = null;
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);            
                while (rs.next()) {
                    User user = new User();
                    int id = rs.getInt("id");
                    String username = rs.getString("username");
                    String name = rs.getString("name");
                    String sex = rs.getString("sex");
                    String jgmc = rs.getString("jgmc");
                    int power = rs.getInt("power");
                    
                    user.setId(id);
                    user.setUsername(username);
                    user.setName(name);
                    user.setSex(sex);
                    user.setJgmc(jgmc);
                    user.setPower(power);
                    list.add(user);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }    
            return list;
        }
        
        public static List<Table> listtable() {
            String sql = "select * from t_table";
            List<Table> list2 = new ArrayList<>();
            Connection conn = DBUtil.getConnection();
            Statement state = null;
            ResultSet rs = null;
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);            
                while (rs.next()) {
                    
                    Table table = new Table();
                    
                    int wjid = rs.getInt("wjid");
                    String jsxqmc = rs.getString("jsxqmc");
                    String jsxqjjfs = rs.getString("jsxqjjfs");
                    String kjhdlx = rs.getString("kjhdlx");
                    String gkglbm = rs.getString("gkglbm");
                    String jgqc = rs.getString("jgqc");
                    String dzxx = rs.getString("dzxx");
                    String lxr = rs.getString("lxr");
                    String sj = rs.getString("sj");
                    int status = rs.getInt("status");
                    
                    table.setWjid(wjid);
                    table.setJsxqmc(jsxqmc);
                    table.setJsxqjjfs(jsxqjjfs);
                    table.setKjhdlx(kjhdlx);
                    table.setGkglbm(gkglbm);
                    table.setJgqc(jgqc);
                    table.setDzxx(dzxx);
                    table.setLxr(lxr);
                    table.setSj(sj);
                    table.setStatus(status);
    
                    list2.add(table);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }    
            return list2;
        }
    
    }
    View Code
  • 相关阅读:
    linux ramdisk
    linux系统灵活运用灯[android课程3]
    linux编译注解
    Linux内核3.0移植并基于Initramfs根文件系统启动
    linux0.11文件分析
    2.2linux内核移植简介
    sudo: ./sd_fusing.sh:找不到命令
    Tiny4412之C语言实现流水灯,Tiny4412裸机程序[3]
    Exynos 4412的启动过程分析[2]
    POJ 3009 Curling 2.0 {深度优先搜索}
  • 原文地址:https://www.cnblogs.com/vvxvv/p/13881777.html
Copyright © 2011-2022 走看看