重拾JSP

1、当 input 的 type 为 hidden 时,称其为隐藏域,隐藏域在页面中对于用户是不可见的,在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序所使用。浏览者单击发送按钮发送表单的时候,隐藏域的信息也被一起发送到服务器。

2、JSP 在处理提交过来的表单信息前,使用 request.setCharacterEncoding("utf-8"); 来将字符编码设置为 UTF-8 以处理中文字符。

3、JSP 的 response 对象的 sendRedirect(String location) 方法的参数为一个字符串,例如 "hello.html"、"hello.jsp" 等等。

4、JSP 的 response 对象的 sendError(int sc) 方法的参数为一个整数,即使用指定的状态码向客户端发送一个出错响应,然后清除缓存。

5、web.xml 页面中可以通过 <error-page> 方法定义出错页面的显示,例如:

<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>

参考文档:

1)https://www.cnblogs.com/kuangwong/p/6078100.html

2)https://blog.csdn.net/qq_37236745/article/details/83625704

原文地址:https://www.cnblogs.com/GjqDream/p/11552373.html