首页 > 代码库 > JSP_<jsp:forward>应用

JSP_<jsp:forward>应用

本文出自:http://blog.csdn.net/svitter


实验环境:Myeclipse10 + tomcat7

简单应用于登陆界面。jsp:forward的作用是,把当前的JSP页引导到另一个页面上,浏览器地址本显示的是当前网页的地址,内容则是另一个界面的。

1.User.html

<!DOCTYPE html>
<html>
<head>
<title>登陆信息</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href=http://www.mamicode.com/"./styles.css">-->>
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+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href=http://www.mamicode.com/"">>
3.errorPage.jsp; 注意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+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href=http://www.mamicode.com/"">>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+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href=http://www.mamicode.com/"">>
对应资源下载:http://download.csdn.net/detail/svitter/7358523