Java Web practice topic-Basic MVC instances

Source: Internet
Author: User

This article introduces an MVC instance involving the following files: l login. JSP -- View part of the input file l success. JSP -- View part of the output file l failure. JSP -- View part of the output file l loginbean. java -- model part l loginservlet. java -- controller part l web. the XML-web application configuration file is described as follows: 1. login. JSP: the input file of this function. The user first accesses this file. It is mainly used to enter the user name and password. The Code is as follows: <% @ page contenttype = "text/html; charset = gb2312" %> <script language = "JavaScript"> function isvalidate (form) {// obtain username = form. username. value; userpass = form. userpass. value; // determine the username length if (! Minlength (username, 6) {alert ("the username length is less than 6 characters! "); Form. username. Focus (); Return false;} If (! Maxlength (username, 8) {alert ("the username length is greater than 8 characters! "); Form. username. Focus (); Return false ;}// determine the password length if (! Minlength (userpass, 6) {alert ("the password length is less than 6 characters! "); Form. userpass. Focus (); Return false;} If (! Maxlength (userpass, 8) {alert ("the password length is greater than 8 characters! "); Form. userpass. focus (); Return false;} return true;} // verify whether the minimum length function minlength (STR, length) {If (Str. length> = length) return true; else return false;} // determines whether the maximum length of the function maxlength (STR, length) {If (Str. length <= length) return true; else return false ;} </SCRIPT> <HTML>

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.