Dynamic page, plainly, is based on certain information (conditions) to change the content presented to the user.
A certain amount of information mentioned here usually refers to the information entered by the user in a form.
Let's look at a common user login interface.
Here we can see a total of three pages, login interface, login successful interface, login failure interface.
However, in order to implement the login interface to jump to two branches, there will be an empty text file, for the page
Jumps provide a direction (judging).
Business logic:
First 4 pages, demo.html (Login interface), login.jsp (judgment), login_success.jsp (successful interface), login_failure.jsp
(Failed interface).
Login interface Form Action property points to login.jsp, after the user clicks the Submit (Login) button, requests to the server (request)
Login.jsp received the request and then began to analyze:
1<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "2pageencoding= "Utf-8"%>3<%4Request.setcharacterencoding ("UTF-8");5String username= request.getparameter ("username");//Get username value6String Password = request.getparameter ("Password");//Get Password value7 if("admin". Equals (username) && "admin". Equals (password)) {8Session.setattribute ("username", username);//Keep username values in the session for subsequent page calls9Request.getrequestdispatcher ("login_success.jsp"). Forward (request, response);//ForwardingTen}Else{ OneResponse.sendredirect ("login_failure.jsp");//Redirect Request A } -%>
This session means that the session will expire from the time you log in to logout, which is why you have logged into a website and browsed
Multi-page or log-in status, and after a long time (the default is 30min) will drop the line.
Java JSP implements Dynamic Web page