下面是struts2标签的常用的用法
<s:url value="/images/copyright.jpg" />
<s:url action="list" namespace="/qxgl" />
一定要注意:url中includeParams的属性的默认值是get,如果没有在struts.xml指定新的值,那么使用url标签引用的所有的静态文件都会带上通过get方法传递的参数值。
另外:includeParams的属性值还有none、all
all,是把get和post中的参数加入到
url参数中
;
none是不把参数加入到url中;
例如:你在detail.jsp中写入
<link href="<s:url value="/css/styleqxgl.css"/>" rel="stylesheet"
type="text/css">
在浏览器中输入http://localhost/detail.jsp?id=5
<link href="/web应用名称/css/styleqxgl.css?id=5" rel="stylesheet"
type="text/css">
这样浏览器就又下载了一次styleqxgl.css,如果你的系统放在公网上,那么带宽的费用是很贵的,使用浏览器的缓存,可以有效的利用带宽,节约成本。
解决这个问题的办法有两个,一个是<s:url value="/css/styleqxgl.css" includeParams="none"/>
另外一个就是在struts.xml中配置,参考下文:
Setting a default value for includeParams
The property struts.url.includeParams can be used to set the default value of the includeParams attribute.
<struts>
...
<constant name="struts.url.includeParams" value="none" />
...
</struts>
See Constant Configuration for further information.
Parameters
Name
Required
Default
Evaluated
Type
Description
action |
false |
|
false |
String |
The action to generate the URL for, if not using value |
anchor |
false |
|
false |
String |
The anchor for this URL |
encode |
false |
true |
false |
Boolean |
Whether to encode parameters |
escapeAmp |
false |
true |
false |
Boolean |
Specifies whether to escape ampersand (&) to (& or not |
forceAddSchemeHostAndPort |
false |
false |
false |
Boolean |
Specifies whether to force the addition of scheme, host and port or not |
id |
false |
|
false |
String |
Deprecated. Use 'var' instead |
includeContext |
false |
true |
false |
Boolean |
Whether actual context should be included in URL |
includeParams |
false |
get |
false |
String |
The includeParams attribute may have the value 'none', 'get' or 'all' |
method |
false |
|
false |
String |
The method of action to use |
namespace |
false |
|
false |
String |
The namespace to use |
portletMode |
false |
|
false |
String |
The resulting portlet mode |
portletUrlType |
false |
|
false |
String |
Specifies if this should be a portlet render or action URL. Default is "render". To create an action URL, use "action". |
scheme |
false |
|
false |
String |
Set scheme attribute |
value |
false |
|
false |
String |
The target value to use, if not using action |
var |
false |
|
false |
String |
Name used to reference the value pushed into the Value Stack |
windowState |
false |
|
false |
String |
The resulting portlet window state |
分享到:
相关推荐
Struts 2 标签库(文档手册) Tags-API-CLSW-JSP <%@ taglib prefix="s" uri="/struts-tags" %> 就能使用struts2.0的标签库 下面就介绍每个标签的具体应用实例说明:按字母排列 A: 1. 2. <s:a href=""></s:a>-...
《Struts 2.0.0 - Struts 2.3.14.1 URL及A标签远程命令执行漏洞探测 V1.1》 使用说明: 运行EXE程序,输入扫描站点的任意一个URL入口链接地址, 若提示扫描是否包含顶级域名下的所有页面,根据提示输入即可。 ...
主要介绍Strus2中的通用标签,主要有<s:url>, , , , , , , , , 等几个标签的具体用法,希望能对大家有帮助。
JSP_struts2标签大全 1.a 3 2.action 3 3. actionerror 4 4. actionmessage 5 5. append 5 6. bean 7 7.checkbox 7 8.checkboxlist 8 9. combobox 9 10. conponent 9 11. date 11 12. datetimepicker 12 13. debug ...
自定义标签,直接代码,直接模仿开发即可 public class ButtonTag extends AttributeTag { //tld中定义的属性 public String label; public String url; public String click; public String confirm; public ...
6.5.2 URL标签 127 6.5.3 i18n和text标签 128 6.5.4 param标签 129 6.6 使用JSTL和其他本地标签 130 6.7 OGNL表达式语言的基础知识 130 6.7.1 什么是OGNL 130 6.7.2 Struts 2中常用的表达式语言特性 131 6.7.3 ...
7.Struts2介绍之使用链接标签.doc 8.Struts2入门.doc 9.Struts2学习进阶(基础篇1-7) 10.Struts2学习进阶(实例篇1)——struts2-blank-2.0.8实例学习.doc 11.改写Restful2ActionMapper让Struts2支持REST风格的URL...
5.4.8 url标签使用介绍 99 5.4.9 param标签使用介绍 101 5.4.10 property标签使用介绍 101 5.5 Struts2表单标签简介 101 5.5.1 基础表单标签使用介绍 102 5.5.2 复杂表单标签使用介绍 106 5.5.3 其它表单标签使用...
该属性通常没有太大的用户,只是当Struts 2需要生成URL时(例如Url标签),该属性才提供Web应用的默认端口. struts.url.https.port 该属性类似于struts.url.http.port属性的作用,区别是该属性指定的是Web应用的加密服务...
北京时间8月22日13时,Apache官方发布通告公布了Struts2中一个远程代码执行漏洞(cve-2018-...第二,当使用没有 value和动作集的url标签时,并且其上层动作集配置没有或只有通配符命名空间值,也可能构成 RCE 攻击。
十二、总结 本教程对struts2的基本知识进行了一些说明,关于struts2的更多详细内容应参看struts2的官方文档及提供的app实例。 下面对struts2的基本执行流程作一简要说明,此流程说明可以结合官方提供的struts2结构图...
url:生成一个URL地址。 表单标签: checkbox标签:复选框。 checkboxlist标签:根据一个集合属性创建一系列的复选框。 combobox标签:生成一个单选文本框和一个下拉列表框的组合。 doubleselect标签:生成一个...
5.1 Struts标签的使用方法 59 5.2 表单标签的共同属性 60 5.3 form标签 62 5.4 textfield、password、hidden标签 63 5.5 submit标签 65 5.6 reset标签 65 5.7 label标签 66 5.8 head标签 66 5.9 textarea...
详细说明了Struts2.0新标签的用法,如url标签、s:checkboxlist标签、s:combobox生成下拉输入框等。
该属性通常没有太大的用户,只是当Struts 2需要生成URL时(例如Url标签),该属性才提供Web应用的默认端口。 struts.url.https.port 该属性类似于struts.url.http.port属性的作用,区别是该属性指定的是Web应用...
3.xml标签库为远程获取,路径:http://struts.apache.org/dtds/struts-2.5.dtd 可设置为本地【xml输入语法快捷提示】,就不用远程获取了:window-->preference-->输入Catalog-->xml下的Catalog-->Add--...
输出Hello World 使用到struts2标签和jstl表达式 2、 URL:http://localhost:8080/struts100515 输入用户名XXX ------> 提交 ,显示 你好 XXX 使用ONGL表达式 3、 URL:...
Struts2 WebWork 2.0 Tags API 中文文档 [CHM] webwork提供了一套不依赖于显示层技术的标签库。这一章我们将概括性的描述每一个标签, 比如此标签支持的属性,标签的行为等等。 大多数的标签都可以用于所有的模板...