Pass the JSP and HTML page values and display them

Source: Internet
Author: User

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>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.