LoginServlet代码:

public class LoginServlet extends HttpServlet{

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String name = req.getParameter("uName");
        String pswd = req.getParameter("uPswd");
        System.out.println("用户名:"+name);
        System.out.println("密码:"+pswd);
    }

}

Login.jsp的代码:

<%@ 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=ISO-8859-1">
<title>登陆界面</title>
</head>
<body>
    <form action="<%= request.getContextPath() %>/loginServlet" method="get">
        userName:<input type="text" name="uname" /><br/>
        userPwsd:<input type="password" name="upwsd" /><br/>
        <input type="submit" value="Login"/>
        <input type="reset" value="Reset"/>
    </form>
</body>
</html>

配置文件

 <servlet>
    <servlet-name>LoginServlet</servlet-name>
    <servlet-class>liu.peng.servlet.LoginServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>LoginServlet</servlet-name>
    <url-pattern>/loginServlet</url-pattern>
  </servlet-mapping>

效果图:

最新文章

  1. 命令查询网站是否开启CDN加速
  2. IIS报错 试图加载格式不正确 的程序集解决办法
  3. 好的 iOS 代码习惯
  4. HDU4502吉哥系列故事——临时工计划
  5. IOS 接ShareSDK问题
  6. System.Data.DbType 与其它DbType的映射关系
  7. 关于quotename的用法
  8. Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace 解决方法
  9. Celery 源码解析五: 远程控制管理
  10. 前端面试题系列(1):doctype作用 标准模式与兼容模式
  11. deeplearning.ai 卷积神经网络 Week 2 深度卷积网络:实例研究 听课笔记
  12. 基于 HTML5 的 WebGL 和 VR 技术的 3D 机房数据中心可视化
  13. PHP 常用设计模式 (转载)
  14. SpringBoot2.0 最简单的 idea 快速创建项目
  15. python模块安装注意事项
  16. 【转载】Vue项目自动转换 px 为 rem,高保真还原设计图
  17. JS频率控制函数
  18. mysql下的将多个字段名的值复制到另一个字段名中(批量更新数据)字符串拼接cancat实战例子
  19. Html解析
  20. RESTful源码学习笔记之RPC和 RESTful 什么区别

热门文章

  1. [BZOJ]4197: [Noi2015]寿司晚宴
  2. [BZOJ]2017省队十连测推广赛1
  3. 【Codeforces Round #431 (Div. 1) D.Shake It!】
  4. mysql 及 posgresql之优劣势大比拼
  5. js删除数组中的元素delete和splice的区别
  6. day06 Request Response
  7. My Stuck in C++
  8. C++ 程序在运行时不显示dos界面
  9. vue通过id从列表页跳转到对应的详情页
  10. 解决问题redis问题:ERR Client sent AUTH, but no password is set