1. Write this most people will, get the value, but get the time will appear we do not want to see the garbled problem
Writing this today is to solve the garbled problem. Here is a small example to explain
2.
(1) First write a JSP page to receive input from the front page
1 <%@ Page Language="Java"ContentType="text/html; Charset=utf-8"2 pageencoding="UTF-8"%>3 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">4 <HTML>5 <Head>6 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">7 <title>Insert Title here</title>8 </Head>9 <Body>Ten <formAction= "view.jsp"Method= "POST"> One <textarearows= "Ten"cols= "+"name= "Content"></textarea> A <inputtype= "Submit"value= "Submit"/> - </form> - </Body> the </HTML>
input.jsp
(2) Write a second JSP page to display
1 <%@ Page Language="Java"ContentType="text/html; Charset=utf-8"2 pageencoding="UTF-8"%>3 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">4 <HTML>5 <Head>6 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">7 <title>Insert Title here</title>8 </Head>9 <Body>Ten <% One request.setcharacterencoding ("UTF-8"); A Stringcontent=Request.getparameter ("content"); - out.println (content); - %> the </Body> - </HTML>
view.jsp
3.
Why is this, because when the Web front-end browser commits, the encoding must be fixed only
4. Result diagram
Input diagram
Result diagram
OK, the validation is complete.