<jsp: param name="param_name" value="param_value" />name 指定参数名称,value 指定参数值。
<%@ page language="java" contentType="text/html;charset=utf-8"%> <html> <head> <title>编程帮-jsp:param</title> </head> <body> <% // 设定传递参数的编码格式 request.setCharacterEncoding("UTF-8"); %> <jsp:forward page="index.jsp"> <jsp:param name="sitename" value="编程帮" /> <jsp:param name="url" value="http://www.lmcjl.com" /> </jsp:forward> </body> </html>index.jsp 代码如下:
<%@ page language="java" contentType="text/html;charset=utf-8"%> <html> <head> <title>编程帮-jsp:param</title> </head> <body> 您好,欢迎登录<%=request.getParameter("sitename")%>! <br /> 网址是<%=request.getParameter("url")%> </body> </html>访问 login.jsp 结果如下:
本文链接:http://task.lmcjl.com/news/6254.html