zoukankan      html  css  js  c++  java
  • Servlet入门

    Tomcat初次使用

    //a.html
    <!
    DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>a</title> </head> <body> <form action="http://localhost:8080/abc/hello" method="get"> <input type="submit"> </form> </body> </html>
    //web.xml
    <?
    xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>com.WebTest01.HelloServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app>
    //index.jsp
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
      <head>
        <title>Test</title>
      </head>
      <body>
        This is Faded828x's first index.jsp page!
      </body>
    </html>
    //HelloServlet.java
    import
    javax.servlet.*; import java.io.IOException; public class HelloServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("doGet"); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("doPost"); } }
  • 相关阅读:
    事件总线Guava EventBus
    DDD—实体和值对象
    DDD—子域和限界上下文
    DDD—什么是领域驱动设计
    DDD—微服务,中台建设为什么需要领域驱动设计
    RabbitMQ 中的 7 种队列模式
    10w 行级别数据的 Excel 导入优化记录
    Java 反射是什么?
    21 条常用 Linux 命令
    一个 java 文件的执行过程
  • 原文地址:https://www.cnblogs.com/faded828x/p/13221631.html
Copyright © 2011-2022 走看看