Lab environment: Myeclipse10 + tomcat7
Simple Application on the login interface. Jsp: forward directs the current JSP page to another page. The address book of the browser displays the address of the current page, and the content is the address of another page.
1.User.html
2. Login. jsp
<%@ page language=java import=java.util.* pageEncoding=utf-8%><%String path = request.getContextPath();String basePath = request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%>
> <% String User = request. getParameter (User); String Password = request. getParameter (Password); if (User. equals (Admin) & Password. equals (Admin) {%> <%} Else {%> <% }%>
3. errorPage. jsp; note that isErrorPage = TRUE;
<%@ page language=java import=java.util.* pageEncoding=UTF-8 isErrorPage=true%><%String path = request.getContextPath();String basePath = request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%>
> Error Message <% = Exception %> 4. welcome. jsp
<%@ page language=java import=java.util.* pageEncoding=UTF-8%><%String path = request.getContextPath();String basePath = request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%>
> Welcome!