The example in this article describes the simple login method implemented by pure JSP. Share to everyone for your reference, specific as follows:
A total of four web.xml, login.jsp, logout.jsp, welcome.jsp four files
Test environment: Tomcat 6.0.x
Assuming the project name is loginsample, my directory structure is this
... \webapps\loginsample\web-inf\web.xml
... \webapps\loginsample\login.jsp
... \webapps\loginsample\logout.jsp
... \webapps\loginsample\welcome.jsp
Web.xml Source code list:
<web-app xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version= "2.4" >
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>
</web-app>
Login.jsp Source code list:
<%@ page contenttype= "Text/html;charset=utf-8"%>
Logout.jsp Source code list:
<%@ page contenttype= "Text/html;charset=utf-8"%>
Welcome.jsp Source code list:
<%@ page contenttype= "text/html" pageencoding= "UTF-8" import= "java.util.*"%>
I hope this article will help you with JSP program design.