From, input, and request objects of JSP

@JSP-From

The From object represents an HTML form, and each time it appears in an HTML document, the from object is created

1.From object collection

elements [] (elements) an array containing all the elements in the form

2.From object properties

Serial number Attributes effect
01 acceptCharset Acceptable character set of the server
02 raft Set or return the frame or window name of the form submission result
03 action Set or return the form's action attribute
04 name Set or return the name of the form
05 id Set or return the form id
06 method Set or return the HTTP method to send data to the server
07 length Returns the number of elements in the form
08 entype Sets or returns the MIME type that the form uses to encode content
09 method Form data will be attached to the URL through the method attribute (post and GET two transmission methods)

### 3. Standard properties

Serial number Attributes method
01 className Set or return the element's class attribute
02 to you Set or return the text direction
03 lang Sets or returns the language code of an element
04 title Sets or returns the element's title attribute

@JSP-Input

### 1. Attribute value
input type = "attribute value" represents an input object from the From form

Serial number value effect
01 button Define clickable buttons
02 checkbox Checkbox
03 file Define input fields and "Browse" button for file upload
04 hidden Define hidden input fields
05 image Define the submit button in the form of an image
06 password Define the password field, the characters in this field are masked
07 radio Define radio buttons
08 reset Define reset button
09 submit Define the submit button. Submit button will send the form data to the server
10 text Define a single-line input field, the user can enter text in it, the default width is 20 characters

@JSP-request

Overview: request for data received html form submission
features:

  1. Encapsulate HTTP request parameter information
  2. Perform attribute value transfer
  3. Complete server jump

method

Serial number method effect
01 getAttribute(String name) Get the value specified by name, or return null if the specified attribute does not exist
02 setAttribute(String name,java.lang.Object obj) Set the value of the request parameter of the name name to obj
03 getParameter(String name) Get the parameter value passed from the client to the server
04 getQueryString () Obtain the query string, which is transmitted to the server by the client GET method
05 getCookie() Returns the client's cookie object, the result is a cookie array
06 getHeader(String name) Or transfer the header information defined by the HTTP protocol
07 getHeaderName() Return the names of all request headers and save the result in an instance of Enumeration class
08 getServerName(String name) Get the name of the server
09 getServerPort(String name) Get the server's port number
10 getRemoteAddr() Obtain the client's IP address
11 getRemoteHost() Get the client's computer name
12 getProtocol() Obtain the protocol name for the client to transmit data to the server
13 getMethod() Method for obtaining data transmitted from client to server
14 getServlePath () Obtain the file path of the script file for the client lock Qingqiu
15 getCharacterEncoding() Get the character encoding in the request
16 getSession(Boolean breate) Return the session related to the request
17 getParameterNames() Get all the parameters worth the name
18 getParameterValues() Get the specified parameter value
19 getRequestURI() Get the client address that sent the request string
20 getContentLength() Get the length of the content
发布了15 篇原创文章 · 获赞 0 · 访问量 150

Guess you like

Origin blog.csdn.net/qq_44230959/article/details/105033861