Servlet instance description

Source: Internet
Author: User

At the morning meeting yesterday, the team lead suddenly asked me how to obtain the information in the client control in the background? I thought about it and replied: if form is used for overall submission, the content in the form is obtained using request in the C # code; if partial submission is used for JS interaction with Ajax, the open () and the send () method to the background, and the onreadystatechange () callback function of Ajax receives the data returned by the background.

When learning Java Web, I never fully understood how html and Servlet interact. Now I use a simple Servlet login instance to explain the interaction mechanism of the entire login process. Source code: http://pan.baidu.com/s/1ntcztbr.

Is the structure of the entire project.

Login.html is the logon page, and set the form processing class to LoginCheck (servlet) in the action attribute of the form table ). LoginCheck then calls Dao to access the SQL database (connect to the database through JDBC) and obtain the query result. The LoginCheck class selects a jump page (involving sendRedirect () redirects and getRequestDispatcher () Redirects Based on the returned results, as shown in blog: http://blog.csdn.net/lishehe/article/details/23133105 for details ).

The sparrow is small and dirty. Through this Demo, you can quickly learn Servlet.

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.