1.1. 页面跳转
可以使用href、page、action三个属性实现struts视图层组件的跳转,三个属性的作用及区别为:① href使用该域名下的相对路径,路径前不需要加“/”,或链接至以http开头其它域名,href="index.jsp"、href="http: //www.baidu.com";② page使用该域名下的绝对路径,路径前需要加“/”;③ action使用该域名下的绝对路径,路径前需要加“/”,与page的区别是可以省略.do;为了生成“http://localhost: 8080/941ok/chat/questFriendIndex.do”这样的链接,分别使用href、page、action的实现如下:
href="questFriendIndex.do";
page="/chat/questFriendIndex.do";
action="/chat/questFriendIndex"、action="/chat/questFriendIndex.do";
1.2. 参数传递
① 传递静态参数,直接写在URL里,例如:href="questFriendIndex.do?username=1&password=1";
② 传递单个动态参数,通过paramId,paramName和paramProperty属性传递Bean里的单个值。paramId属性告诉jsp编译引擎要传送的参数名称是什么,“?”号后面,“=”号前面的内容;paramName属性和paramProperty属性告诉编译引擎使用哪个Bean 的哪个属性值,构造“=”后面的内容。如果beanName的property beanProperty的值为beanPropertyValue,那么<html:link page="chat/questFriendIndex.do" paramId="param_name" paramName="beanName" paramProperty="beanProperty">对应的url是http://localhost: 8080/941ok/chat/questFriendIndex.do?param_name=beanPropertyValue;
③ 传递多个动态参数,通过name属性传递在request对象里设置的Map类型的对象里的多个参数;假设如果你定义下面的一个map:
Map mapName=new HashMap();
mapName.put("paramValue1","value1");
mapName.put("paramValue2","value2");
request.setAttribute("mapName",mapName);
在jsp页面有下面的一个链接:
<html:link action="/chat/questFriendIndex" name="mapName">
对以的链接是:
http://localhost:8080/941ok/chat/questFriendIndex.do?paramValue1=value1¶mValue2=value2
1.3. 示例应用结构
{$tomcat_home\webapps}
|__941ok
|__WEB-INF
|__chat
|__index.jsp
|__questFriendIndex.do
分享到:
相关推荐
struts标签使用中文说明文档 struts标签使用中文说明文档struts标签使用中文说明文档
struts标签使用例子,全面解释了struts1.2中的重要标签使用说明
详细解释并按照顺序将struts标签一一演示和使用的工程!
struts2标签使用例子 struts2标签使用例子 struts2标签使用例子struts2标签使用例子
struts标签的说明与使用,为方便广大程序员更熟练的掌握JSP页面标签的使用
struts标签 • Bean Tags:该标签库包含的标签可以用来创建bean、访问bean和访问bean的属性。同时提供了依据cookies、headers和parameters的值创建相关bean的能力。 HTML Tags:该标签库包含的标签可以用来创建...
struts标签库里面包括struts所有的标签使用源码
struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库
Struts2标签库Struts2标签库Struts2标签库Struts2标签库Struts2标签库Struts2标签库
1.struts标签的使用 2.struts常用html标签库 3.在STRUTS中如何使用标签
struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签
struts2标签库struts2标签库struts2标签库struts2标签库
Struts标签 Struts标签Struts标签Struts标签Struts标签
struts标签库,里面详细介绍了如何使用各种struts标签.
5.掌握常用标签textfield、radio、paaaword、checkboxlist、select、data的使用方法,实现页面与Action的交互操作 6.要求在创建过程中,包的名称要体现班级和学号,项目名称不需要按照实验手册中书写。在做的过程中...
Struts标签 大全
Struts提供了五个标签库,即:HTML、Bean、Logic、Template和Nested。 HTML 标签 : 用来创建能够和Struts 框架和其他相应的HTML 标签交互的HTML 输入表单 ...Nested标签: 增强对其他的Struts 标签的嵌套使用的能力
struts 1.2 标签使用说明,简单介绍了struts1.2的标签使用
Struts 标签 页面跳转 数据库操作 Struts 标签 页面跳转 数据库操作 Struts 标签 页面跳转 数据库操作
包含了Struts2标签使用介绍的详细文档及APi文档,方便实用