Simple implementation of JSP user forms

Source: Internet
Author: User

1 <%@ Page Language="Java"ContentType="text/html; Charset=utf-8"2 pageencoding="Utf-8"Import="java.util.*" %>3 <%@ Page Import="java.sql.*" %>4 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">5 <HTML>6 <Head>7 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">8 <title>User Forms</title>9 </Head>Ten <Body> One <Center> A     <formAction= "setpropertydemo.jsp"Method= "POST"> -         <Table> -             <TR> the                 <TDcolspan= "2">User Forms</TD> -             </TR> -             <TR> -                 <TD>User name:</TD> +                 <TD><inputtype= "text"name= "username"></TD> -             </TR> +             <TR> A                 <TD>Dense&nbsp;&nbsp;Code:</TD> at                 <TD><inputtype= "Password"name= "UserPassword"></TD> -             </TR> -             <TR> -                 <TDcolspan= "2"> -                 <inputtype= "Submit"name= "Submit"> -                 <inputtype= "Reset"name= "Reset"> in             </TR> -         </Table> to     </form> + </Center> - </Body> the </HTML>

This form simply implements the parameter passing of the user name + password.

After the page submits a user name and password, it jumps to another page setpropertydemo.jsp, outputting the submitted user information.

The code for SETPROPERTYDEMO.JSP is as follows:

1 <%@ Page Language="Java"ContentType="text/html; Charset=utf-8"2 pageencoding="Utf-8"Import="java.util.*" %>3 <%@ Page Import="java.sql.*" %>4 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">5 <HTML>6 <Head>7 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">8 <title>Setting the JavaBean Property</title>9 </Head>Ten <Body> One     <Jsp:usebeanID= "User"Scope= "page"class= "Chapter7." UserBean "></Jsp:usebean> A     <Jsp:setproperty Property="*"name= "User"/> -     <% - Out.println ("User name:"+User.getusername ()+"<br/>"); the Out.println ("User password:"+User.getpassword ()); -     %> - </Body> - </HTML>

Simple implementation of JSP user forms

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.