<%@ page contentType="text/html; charset=GBK" language="java" errorPage=""%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>forward 原始页</title> </head> <body> <h3>forward 的原始页</h3> <jsp:forward page="forward-result.jsp" > <jsp:param value="29" name="age"/> </jsp:forward> </body> </html>
<%@ page contentType="text/html; charset=GBK" language="java" errorPage=""%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>forward结果页</title> </head> <body> <!-- 使用request 内置对象获取age参数的值 --> <%=request.getParameter("age") %> <%=request.getParameter("username") %> </body> </html>
<%@ page contentType="text/html; charset=UTF-8" language="java" errorPage=""%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jsp-include测试</title> </head> <body> <!-- 使用动态的include指令导入页面 --> <jsp:include page="scriptlet.jsp" /> </body> </html>
<%@ page contentType="text/html; charset=UTF-8" language="java" errorPage=""%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jsp-include测试</title> </head> <body> <!-- 使用动态的include指令导入页面 --> <jsp:include page="scriptlet.jsp" /> </body> </html>