- HTML: test/html
- XML:test/xml
- Spreatsheets: application/vnd.ms-excel
- JPEG:image/jpeg
Put the setContentType line before any of the lines that use the PrintWriter.
2. public void init()
The init method is called only when the servlet is first loaded, before the first request is processed.
2. public void init()
The init method is called only when the servlet is first loaded, before the first request is processed.
- redeployed servlet
- modify web.xml
3. Note that the use of JavaScript for client-side validation does not remove the need for also doing this type of checking on the server.
client side (JavaScript) <-> server side
Besides, clients can use their own HTML forms, can manually edit URLs that contain GET data, and can disable JavaScript.
4. check the empty input on server side
4.7 Automatically Populating Java Objects from Request Parameters
getParameterMap
java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
- Returns a java.util.Map of the parameters of this request.Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
-
- Returns:
- an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
No comments:
Post a Comment