标签:ons 程序 name ppi 规则 servlet XML xtend void
package com.sunxiaping; import java.io.IOException; /** * @author 许威威 */ public class HelloWorldServlet extends javax.servlet.http.HttpServlet { @Override protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException { response.setContentType("text/html;charset=utf-8"); response.getWriter().println("你好 Servlet"); } @Override protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException { this.doPost(request, response); } }
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <servlet> <servlet-name>HelloWorldServlet</servlet-name> <servlet-class>com.sunxiaping.HelloWorldServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorldServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app>
标签:ons 程序 name ppi 规则 servlet XML xtend void
原文地址:https://www.cnblogs.com/xuweiweiwoaini/p/11366854.html