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"); } }
  • 相关阅读:
    七层协议和四层协议
    eclipse 在jboss的debug配置(ubuntu系统)
    Maven三种仓库的配置
    oracle触发器使用
    为什么要进行URL编码
    LevelDB Compaction原理
    使用python处理selenium中的窗口切换问题
    使用python处理selenium中的鼠标悬停问题
    测试模型
    jenkins for mac
  • 原文地址:https://www.cnblogs.com/faded828x/p/13221631.html
Copyright © 2011-2022 走看看