20:43:06

package com.chinasofti.dao;

import java.util.List;

import com.chinasofti.entity.User;

public interface user_dao {
//登录
public boolean dl(User user);
//注册
public boolean zc(User user);
//查看用户
public List<User> userShow();
//删除用户
public void userdelete(int id);
//修改用一 先找到用户
public User toupadte(int id);
//修改用二 修改用户
public void upadte(User user);
//添加
public void adduser(User user); }

20:43:54

package com.chinasofti.dao.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import org.apache.catalina.Session;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import com.chinasofti.dao.user_dao;
import com.chinasofti.entity.User; @Repository(value="dao")
public class user_daoimpl implements user_dao{ @Autowired
private SqlSessionFactory sessionFactory;
/**
* 登录
*/
@Override
public boolean dl(User user) {
boolean flag=false;
SqlSession session = sessionFactory.openSession();
String select="com.chinasofti.mapper.userMapper.showuser";
Object i = session.selectOne(select, user);
if (i!=null) {
return flag=true;
}else {
return flag;
}
}
/**
* 注册
*/
@Override
public boolean zc(User user) {
boolean flag=false;
SqlSession session = sessionFactory.openSession();
String select="com.chinasofti.mapper.userMapper.showuser";
Object i = session.selectOne(select, user);
if (i!=null) {
return flag;
}else {
String add="com.chinasofti.mapper.userMapper.zcuser";
int insert = session.insert(add, user);
return flag=true;
}
}
/**
*查看用户
*/
@Override
public List<User> userShow() {
SqlSession session = sessionFactory.openSession();
String select="com.chinasofti.mapper.userMapper.usershow";
List<User> userlist=session.selectList(select);
return userlist; }
/**
* 删除用户
*/
@Override
public void userdelete(int id) {
SqlSession session = sessionFactory.openSession();
String deleteuser="com.chinasofti.mapper.userMapper.deleteuser";
int delete = session.delete(deleteuser, id);
}
/**
* 修改用户
*/
//先找到用户
@Override
public User toupadte(int id) {
SqlSession session = sessionFactory.openSession();
System.out.println(id+">>>>>>>>>>>>>>>");
User user= session.selectOne("com.chinasofti.mapper.userMapper.selectuser", id);
System.out.println(user.toString());
return user;
}
@Override
public void upadte(User user) {
SqlSession session = sessionFactory.openSession();
String update="com.chinasofti.mapper.userMapper.updateUser";
session.update(update, user);
}
/**
*添加用户
*/
@Override
public void adduser(User user) {
SqlSession session = sessionFactory.openSession();
String insert="com.chinasofti.mapper.userMapper.adduser";
session.insert(insert, user);
} }

20:44:19

package com.chinasofti.entity;

public class User {
private Integer u_id;
private String u_name;
private String u_password;
public Integer getU_id() {
return u_id;
}
public void setU_id(Integer u_id) {
this.u_id = u_id;
}
public String getU_name() {
return u_name;
}
public void setU_name(String u_name) {
this.u_name = u_name;
}
public String getU_password() {
return u_password;
}
public void setU_password(String u_password) {
this.u_password = u_password;
}
@Override
public String toString() {
return "User [u_id=" + u_id + ", u_name=" + u_name + ", u_password=" + u_password + "]";
}
public User(String u_name, String u_password) {
super();
this.u_name = u_name;
this.u_password = u_password;
}
public User() {
super();
}
public User(Integer u_id, String u_name, String u_password) {
super();
this.u_id = u_id;
this.u_name = u_name;
this.u_password = u_password;
} }

20:44:34

package com.chinasofti.handler;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import com.chinasofti.entity.User;
import com.chinasofti.service.user_service; @Controller
public class handler {
private static final String SUCCESS="success";
boolean flag=false; @Autowired
HttpServletRequest request; List<User> userlist=null; @Resource(name="service")
private user_service service; /**
* 登录
*/
@RequestMapping(value="/dl")
public String dl(User user) {
flag=service.dl(user);
if (flag==true) {
return SUCCESS;
}else{
return "redirect:/login.jsp";
}
} /**
* 注册
*/
@RequestMapping(value="/zc")
public String zc(User user) {
flag=service.zc(user);
if (flag==true) {
return "redirect:/login.jsp";
}else{
return "redirect:/zc.jsp";
}
} /**
* 查看用户
*/
@RequestMapping(value="/ck")
public String userlist() {
userlist=service.userShow();
request.getSession().setAttribute("userlist", userlist);
return "userShow";
} /**
* 删除用户
*/
@RequestMapping(value="/del", method = RequestMethod.GET)
public String userdelete(@RequestParam("id") int id) {
service.userdelete(id);
return SUCCESS;
}
/**
* 修改用户 先找到用户
*/
@RequestMapping(value="/toupdate", method = RequestMethod.GET)
public String toupdateuser(@RequestParam("id") int id) {
System.out.println(id);
User user=service.toupadte(id);
System.out.println(user);
request.getSession().setAttribute("userupdatelist", user);
return "update";
}
@RequestMapping(value="/update")
public String updateuser(User user) {
service.upadte(user);
return SUCCESS;
}
/**
* 添加用户
*/
@RequestMapping(value="/add")
public String add() {
return "add";
}
@RequestMapping(value="/adduser")
public String adduser(User user) {
service.adduser(user);
return SUCCESS;
} }

20:44:51

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinasofti.mapper.userMapper"> <!-- 登录 -->
<select id="showuser" resultType="int" parameterType="com.chinasofti.entity.User">
select *
from users where u_name=#{u_name} and
u_password=#{u_password}
</select> <!-- 注册 -->
<insert id="zcuser" parameterType="com.chinasofti.entity.User">
insert into users
values(null,#{u_name},#{u_password})
</insert> <!-- 查看 -->
<select id="usershow" resultType="com.chinasofti.entity.User">
select * from users
</select> <!-- 根据id查询删除一个user -->
<delete id="deleteuser" parameterType="com.chinasofti.entity.User">
delete from users where u_id=#{id}
</delete> <!-- 添加user -->
<insert id="adduser" parameterType="com.chinasofti.entity.User">
insert into users
values(null,#{u_name},#{u_password})
</insert> <!-- 修改user -->
<!-- 查看 -->
<select id="selectuser" resultType="com.chinasofti.entity.User">
select * from users where u_id=#{u_id}
</select> <update id="updateUser" parameterType="com.chinasofti.entity.User">
update users set u_name=#{u_name},u_password=#{u_password} where u_id=#{u_id}
</update> </mapper>

20:45:13

package com.chinasofti.service;

import java.util.List;

import com.chinasofti.entity.User;

public interface user_service {
//登录
boolean dl(User user);
//注册
boolean zc(User user);
//查看用户
public List<User> userShow();
//删除用户
public void userdelete(int id);
//修改用户 先找到
public User toupadte(int id);
//修改用户
public void upadte(User user);
//添加
public void adduser(User user);
}

20:45:32

package com.chinasofti.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import com.chinasofti.dao.user_dao;
import com.chinasofti.entity.User;
import com.chinasofti.service.user_service; @Service(value="service")
public class user_serviceimpl implements user_service {
@Resource(name="dao")
private user_dao userdao;
//登录
@Override
public boolean dl(User user) {
return userdao.dl(user);
}
//注册
@Override
public boolean zc(User user) {
return userdao.zc(user);
}
//查看用户
@Override
public List<User> userShow() {
return userdao.userShow();
}
//删除用户
@Override
public void userdelete(int id) {
userdao.userdelete(id);
}
//修改用户 先找到
@Override
public User toupadte(int id) {
return userdao.toupadte(id);
}
@Override
public void upadte(User user) {
userdao.upadte(user);
}
@Override
public void adduser(User user) {
userdao.adduser(user);
} }

20:45:48

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<!-- 开启扫描 -->
<context:component-scan base-package="com"></context:component-scan>
<!-- 启动aop支持 -->
<aop:aspectj-autoproxy />
<!-- 引入数据源 -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:datasource.properties</value>
</property>
</bean>
<!-- 配置数据源 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driver}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!-- 配置session工厂 -->
<bean id="sqlsessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:mybatis.config.xml"></property>
</bean>
<!-- 配置事物管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
</beans>

20:46:12

jdbc.driver=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql:///ssm?useUnicode=true&characterEncoding=UTF-8

jdbc.username=root

jdbc.password=root

20:47:43

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout

20:47:57

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<mappers>
<mapper resource="com/chinasofti/mapper/userMapper.xml"/>
</mappers>
</configuration>

20:48:16

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<!-- 配置扫描 -->
<context:component-scan base-package="com"></context:component-scan> <!-- 配置静态资源不过滤 -->
<mvc:default-servlet-handler />
<!-- 在实际开发中都需要配置 mvc:annotation-driven 标签 -->
<mvc:annotation-driven/> <!-- 配置前缀和后缀 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!-- 配置上传 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8"></property>
<property name="maxUploadSize" value="1024000"></property>
</bean>
</beans>

20:48:31

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="adduser" method="post">
<input type="text" name="u_name">
<input type="text" name="u_password">
<input type="submit" value="添加">
</form>
</body>
</html>

20:49:22

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8" isErrorPage="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
你登录成功了小伙儿
<br>
<br>
<a href="ck">查看用户</a>
</body>
</html>

20:49:49

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="update" method="post">
<input type="text" name="u_id" value="${userupdatelist.u_id }" readonly="readonly">
<input type="text" name="u_name" value="${userupdatelist.u_name }">
<input type="text" name="u_password" value="${userupdatelist.u_password }">
<input type="submit" value="确认修改">
</form>
</body>
</html>

20:50:04

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<table border="1" bordercolor="red">
<tr>
<td>编号</td>
<td>账户</td>
<td>密码</td>
<td>删除</td>
<td>修改</td>
</tr>
<c:forEach items="${userlist}" var="l">
<tr>
<td>${l.u_id}</td>
<td>${l.u_name}</td>
<td>${l.u_password}</td>
<td ><a href="del?id=${l.u_id}">删除</a></td>
<td><a href="toupdate?id=${l.u_id}">修改</a></td>
</tr>
</c:forEach>
</table>
<a href="add">添加用户</a> </body>
</html>

20:50:16

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Struts2Hibernate5Spring4</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- The front controller of this Spring Web application, responsible for
handling all application requests --> <!-- spring-mvc -->
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<!-- -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
</web-app>

20:50:39

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8" isErrorPage="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<a href="login.jsp">登录</a><br>
<a href="zc.jsp">注册</a>
</body>
</html>

20:50:55

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="dl">
<input type="text" name="u_name"><br> <input type="password" name="u_password"><br><br>
<input type="submit" value="登录">
</form>
</body>
</html>

20:51:06

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="update">
用户名<input readonly="readonly" name="u_name"><br>
修改密码<input type="text" name="u_password"><br><br>
<input type="submit" value="确认修改">
</form>
</body>
</html>

20:51:21

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="zc">
用户名<input type="text" name="u_name"><br>
密码<input type="password" name="u_password"><br><br>
<input type="submit" value="注册">
</form>
</body>
</html>

2017-09-07  20:51:38

【SSM】---增删改查的更多相关文章

  1. SSM增删改查

    闲着无聊配置一遍SSM以及添加功能增删改查,如下图,其中坎坷也挺多!!! 1.工程如下图.(请忽略红叉,没有错误) 2.首先配置pom.xml文件. <project xmlns="h ...

  2. 基于SSM之Mybatis接口实现增删改查(CRUD)功能

    国庆已过,要安心的学习了. SSM框架以前做过基本的了解,相比于ssh它更为优秀. 现基于JAVA应用程序用Mybatis接口简单的实现CRUD功能: 基本结构: (PS:其实这个就是用的Mapper ...

  3. SSM框架搭建(Spring+SpringMVC+MyBatis)与easyui集成并实现增删改查实现

    一.用myEclipse初始化Web项目 新建一个web project: 二.创建包 controller        //控制类 service //服务接口 service.impl //服务 ...

  4. ssm学习(四)--完整的增删改查demo

    上一篇文章简要介绍了将sping mvc加入整个框架,算是完成了ssm的集成.本节继续前面的内容,结合spring mvc做一个简单的增删改查demo. 1.首先,重写一下GeckoList.jsp页 ...

  5. 搭建ssm框架,可实现登录和数据展示以及增删改查

    需求: 后台使用ssm(spring-springMVC-mybatis)进行整合 前台使用bootstrap框架 前后台交互使用Ajax进行发送 表结构: 登录页面后显示所有用户信息,可对每条进行增 ...

  6. SpringMVC之简单的增删改查示例(SSM整合)

    本篇文章主要介绍了SpringMVC之简单的增删改查示例(SSM整合),这个例子是基于SpringMVC+Spring+Mybatis实现的.有兴趣的可以了解一下. 虽然已经在做关于SpringMVC ...

  7. bootstrap+Ajax+SSM(maven搭建)实现增删改查

    https://www.jianshu.com/p/d76316b48e3e 源码: https://github.com/Ching-Lee/crud 功能点: 分页 数据校验 ajax Rest风 ...

  8. 增删改查的SSM小项目

      经过将近一个月的摸索,终于算是勉强完成了关于增删改查的SSM项目. github源码地址:https://github.com/123456abcdefg/Login 好了,话不多说,写一下具体代 ...

  9. IDEA搭建SSM实现登录、注册,数据增删改查功能

     本博文的源代码:百度云盘/java/java实例/SSM实例/SSM实现登录注册,增删改查/IDEA搭建SSM实现登录,注册,增删改查功能.zip 搭建空的Maven项目 使用Intellij id ...

  10. 【项目笔记】完成一个基于SSM框架的增删改查的模块后总结的问题

    最近为了准备新工作重新摸出了SSM框架,同时从0学习了JQuery,终于用一周做完了一个包括增删改查的模块(主要是属性太多了,其中一个类50+,复制粘贴耗时). 从中特意记下了几个遇到的问题,总结一下 ...

随机推荐

  1. mysql 存储过程(二)

    存储过程(Stored Procedure): 一组可编程的函数,是为了完成特定功能的SQL语句集,经编译创建并保存在数据库中,用户可通过指定存储过程的名字并给定参数(需要时)来调用执行. 优点(为什 ...

  2. jedis基本操作命令

    1.对value操作的命令 exists(key):确认一个key是否存在 del(key):删除一个key type(key):返回值的类型 keys(pattern):返回满足给定pattern的 ...

  3. 第二章 Vue快速入门-- 23 品牌案例-根据关键字实现数组的过滤

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  4. java 观察这模式(发布订阅模式)

    观察者设计模式定义了对象间的一种一对多的组合关系,以便一个对象的状态发生变化时,所有依赖于它的对象都得到通知并自动刷新. 发布者发布信息,订阅者获取信息,订阅了就能收到信息,没订阅就收不到信息. 抽象 ...

  5. 用Python实现的二分查找算法(基于递归函数)

    一.递归的定义 1.什么是递归:在一个函数里在调用这个函数本身 2.最大递归层数做了一个限制:997,但是也可以自己限制 1 def foo(): 2 print(n) 3 n+=1 4 foo(n) ...

  6. 【转载】浅析python日志重复输出问题

    出处:https://www.cnblogs.com/huang-yc/p/9209096.html 问题起源: ​ 在学习了python的函数式编程后,又接触到了logging这样一个强大的日志模块 ...

  7. 实现分享功能(分享到qq空间,新浪微博)

        //分享QQ好友    function qq(title,url,pic)    {        var p = {            url: 'http://test.qichey ...

  8. cgi 检索Cookie信息

    Cookie信息检索页非常简单,Cookie信息存储在CGI的环境变量HTTP_COOKIE中,存储格式如下: key1=value1;key2=value2;key3=value3.... 以下是一 ...

  9. ASP.NET大文件上传断点续传解决方案

    HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...

  10. OCWA提高组模拟赛一 Solution

    Problem A RecMin 给出一个$n \times m$的矩阵,其中$1 \leq n,m \leq 3\ times 10^3$ 给出整数$a,b$,求出在矩阵中所有$a\ times b ...