<body>
<%
request.setAttribute("name","土二");
Date now = new Date();
request.setAttribute("now",now);
Map map = new HashMap();
map.put("name","土二");
map.put("sex","m");
map.put("age","25");
request.setAttribute("person",map);
%>
<a href="/strutsdemo/RegUser.do">注册</a> <br><!-- 最基本的链接 -->
<a href="${pageContext.request.contextPath}/RegUser.do">注册</a> <br><!-- EL表达式自动获取路径,注意是花括号 -->
<html:link action="RegUser">注册</html:link> <!-- html:link标签,以后不叫.do了也用改代码 --><br>
<html:link action="RegUser?name=土二">注册(url编码)</html:link> <!-- 未编码 --><br>
<html:link action="RegUser" paramId="username" paramName="name">注册(url编码)</html:link> <!-- 土二的utf-8编码 --><br>
<html:link action="RegUser" paramId="usertime" paramName="now" paramProperty="time">注册(url属性编码)</html:link> <!-- 取date的time属性 --><br>
<html:link action="RegUser" name="person">注册(url多个属性编码)</html:link> <!-- 取date的time属性 --><br>
<br>
张孝祥的视频里提到的链接方式和连接属性生成的一段代码
最新推荐文章于 2024-07-16 15:41:31 发布