There are two page files in total:
1ininput.html is mainly used to display the page and input and submit the input information to the page;
Input.html
1 <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd" > 2 < Html > 3 < Head > 4 < Meta HTTP-equiv = "Content-Type" Content = "Text/html; charsets = UTF-8" > 5 < Title > Input </ Title > 6 < Script Type = "Text/JavaScript" Language = "JavaScript" > 7 Function Validate (f ){ 8 If (Document.form1.info. Value = "" | Document.form1.info. Value = Null ){ 9 Window. Alert ( " Input is null! Please input some infomation ...... " ); 10 F.info. Focus () 11 Return False ; 12 } 13 14 } 15 </ Script > 16 </ Head > 17 < Body > 18 19 < Form ID = "Form1" Name = "Form1" Method = "Post" Action = "Input. jsp" Onsubmit = "Return validate (this )" > 20 The input Informations: < Input Type = "Text" Name = "Info" /> 21 < Input Type = "Submit" Value = "Show" /> 22 </ Form > 23 </ Body > 24 </ Html >
2. The input. jsp file is mainly used to process HTML submitted information and then return the processing result to HTML.
Input. jsp
1 <% @ Page Language = "Java" contenttype = "text/html; charset = ISO-8859-1" 2 Pageencoding = "ISO-8859-1" %> 3 <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> 4 <HTML> 5 <Head> 6 <Meta http-equiv = "Content-Type" content = "text/html; charset = ISO-8859-1"> 7 <Title> insert title here </title> 8 </Head> 9 <Body> 10 <% 11 String STR = request. getparameter ("info" ); 12 Out. println ("the input Informations:" + " ); 13 %> 14 15 </Body> 16 </Html>