<a href = "jsp2.jsp">链接1</a><BR>
<html:link page = "/jsp2.jsp">链接2</html:link><BR>
<html: link href = "jsp2.jsp">链接3</html:link><BR>
<html:link forward = "jsp2.jsp">链接4</html:link><BR>
配合配置文件:
<global-forwards>
<forward name="JSP2" path = "/jsp2.jsp"></forward>
</globals>-forward
<html:link forward = "jsp2">链接4</html:link><BR>
<html:link action = "/XXX.do">链接5(适合链接同时还做一些操作的情况)</html:link><BR>
以下是传值:
<html:link page = "/jsp2.jsp?param=0001">到达jsp2,传参数</html:link>
接受参数: 参数param:<%=request.getParameter("param")%>
<%
sesson.setAttribute("msg","0001_session");
request.setAttrbute("msg","<B>0001_request<B>");
application.setAttribute("msg","0001_applicaiton");
//自动从page--request--session--application
//这个是JavaBean 传值
Student stu = new Student();
stu.setStuId("0001");
session.setAttribute("stu",stu);
//多个参数可以放入HashMap
HashMap hm = new HashMap();
hm.put("param1","msg1");
hm.put("param2","msg2");
hm.put("param3","msg3");
session.setAttribute("paramList",hm);
Cookie传值
response.addCookie(new Cookie("username","Kate"));
%>
<html:link page="/jsp2.jsp" paramID="param" paramName="msg">到达Jsp,传参数</html:link> //paramName 或name 是要传的值, id是参数名
<html:link page="jsp2.jsp" name = "paramList">到达jsp2,传参数</html:link><BR>
<html:link page="/jsp2.jsp" paramID="param" paramName="stu" ParamProperty="stuId">到达Jsp,传参数</html:link>
接收cookie的值:Cookie的值:<bean:cookie name="username", id = "cookie1"/><bean:write name="cookie1" property="value"/>