20170704
来源:互联网 发布:怎么抢购淘宝一元拍 编辑:程序博客网 时间:2024/06/05 21:04
404 :资源未找到
500:服务器内部错误
se 69
http://localhost/20170704/first
<%@ 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>登录页面</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 method="post" action="LonginServlet">
用户名:<input type="text" name="username"/><br>
密码:<input type="password" name="password"/><br>
<input type="submit" value="登录"/>
</form>
</body>
</html>
public class LonginServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String username = request.getParameter("username");
String password = request.getParameter("password");
PrintWriter out = response.getWriter();
out.println("用户名:" + username);
out.println("密码:" + password);
UserDao userDao = UserDao.getInstance();
Map<String, String> map = new HashMap<String, String>();
map.put("username", username);
map.put("password", password);
User user = userDao.getUserByMap(map);
if(user != null){
out.print("在数据库中存在");
}else{
out.print("在数据库中不存在");
}
out.flush();
out.close();
}
}
<servlet>
<servlet-name>LonginServlet</servlet-name>
<servlet-class>com.yy.servlet.web.servlet.LonginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LonginServlet</servlet-name>
<url-pattern>/LonginServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
- 20170704
- 20170704
- 20170704
- 20170704总结
- 20170704 第二天上班
- 学习笔记20170704
- 20170704学习笔记
- 一起来讨论讨论Java多线程技术-20170704
- 20170704unable to find valid certification path to requested target
- CSDN日报20170704——《和代码的青春七年》
- 20170704Windows10_08_临界区、线程静态变量、Slim锁、线程状态
- 干货 | 自更新CC 2015.3以上版本,都默认自动安装C盘,真的无法转移其他的盘吗?
- [Matlab]Invalid mex-file 找不到指定的模块
- Java 领域从传统行业向互联网转型你必须知道的事儿 我为什么要写这篇文章 武林中,"天下武功出少林"指各门各派的武功都与少林武学有一定的渊源,技术也是相同的道理,对于Java领域的应用而言,传统
- epoll服务器
- Spring 任务调度
- 20170704
- [Eclipse手册]设置pom.xml打开方式
- 7/4日总结
- 关于springMVC的@RequestMapping的注解属性说明
- PL SQL Developer 远程链接Oracle数据库的相关配置
- Unity面试题
- Java_log2000_访问控制对子类的影响
- PHP文件的上传与下载总结(已经很详细了)
- Jar包冲突如何快速解决