When we browse the web, we often need to submit information to the server and let the background program process it. The browser uses the GET and POST methods to submit data to the server.
JSP form processing syntax
The GET method adds the requested encoding information after the URL, and the URL and encoding information are separated by a "?" symbol. The data submitted by POST is invisible, and GET is passed in the URL (you can look at the address bar of your browser).
JSP form processing example
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.io.*,java.util.*" %> <!DOCTYPE html> <html><head> <meta charset="utf-8"> <title>php.cn</title> </head> <body> <h1>使用 GET 方法读取数据</h1> <ul> <li> <p> <b>站点名:</b> <%= request.getParameter("name")%> </p> </li> <li> <p> <b>网址:</b> <%= request.getParameter("url")%> </p> </li> </ul> </body> </html>