通用标签(数据类)
l Param 参数
名称 |
必须 |
默认值 |
类型 |
描述 |
name |
否 |
|
String |
名称标识 |
value |
否 |
|
String |
值 |
- < ui:component >
- < ui:param name = "key" value = "[0]" />
- </ ui:component >
- < s:bean name = "org.apache.struts2.example.counter.SimpleCounter" var = "counter" >
- < s:param name = "foo" value = "BAR" />
- < s:property value = "foo" />
- </ s:bean >
Param 不能形成一个独立的标签,必须嵌入到其它标签中,如 bean,url…
l url , a ,
a: 形同于 html 的 a. 并且拥有其大部分属性
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
href |
否 |
|
String |
链接地址 |
name |
否 |
|
String |
名称标识 |
onclick |
否 |
|
String |
单击事件 |
value |
否 |
|
String |
值 |
… |
… |
|
… |
… |
- < s:url id = "testUrlId" namespace = "/subscriber" action = "customField" method = "delete" >
- < s:param name = "customFieldDefinition.id" value = "${id}" />
- </ s:url >
- < s:a errorText = "Sorry your request had an error." preInvokeJS = "confirm('Are you sure you want to delete this item?')" href = "%{testUrlId}" >
- < img src = "<s:url value=" /images/delete.gif" /> " border = "none" /> </ s:a >
url :在页面上创建一个url
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
action |
否 |
|
String |
事件 |
method |
否 |
|
String |
方法 |
value |
否 |
|
String |
值 |
… |
… |
|
… |
… |
- < s:url value = "editGadget.action" >
- < s:param name = "id" value = "%{selected}" />
- </ s:url >
l bean 、 action
bean: 创建 bean
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
name |
是 |
|
String |
名称标识 |
- <s:bean name= "org.apache.struts2.example.counter.SimpleCounter" var= "counter" >
- <s:param name= "foo" value= "BAR" />
- The value of foot is : <s:property value= "foo" />, when inside the bean tag
- </s:bean>
Action: 创建 action
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
name |
是 |
|
String |
事件 |
namespace |
否 |
|
String |
|
executeResult |
否 |
false |
Boolean |
|
flush |
否 |
true |
Boolean |
|
ignoreContextParams |
否 |
false |
Boolean |
|
- < s:action name = "actionTagAction" executeResult = "true" />
l date
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
name |
是 |
|
String |
名称标识 |
format |
否 |
|
String |
格式化匹配 |
nice |
否 |
false |
Boolean |
|
- < s:date name = "person.birthday" format = "dd/MM/yyyy" />
- < s:date name = "person.birthday" format = "%{getText('some.i18n.key')}" />
- < s:date name = "person.birthday" nice = "true" />
l include
名称 |
必须 |
默认值 |
类型 |
描述 |
name |
是 |
|
String |
名称标识 |
- < s:include value = "myJsp.jsp" >
- < s:param name = "param1" value = "value2" />
- < s:param name = "param2" value = "value2" />
- </ s:include >
property 、 push 、 set
property: 输出属性
名称 |
必须 |
默认值 |
类型 |
描述 |
default |
否 |
|
String |
默认 |
escape |
是 |
|
Boolean |
|
value |
否 |
|
Object |
值 |
- < s:push value = "myObject" >
- < s:bean name = "jp.SomeBean" var = "myBean" />
- < s:param name = "myParam" value = "top" />
- </ s:bean >
- </ s:push >
Push: 向栈压
Set :设置属性
名称 |
必须 |
默认值 |
类型 |
描述 |
id |
否 |
|
String |
id 标识 |
name |
否 |
|
String |
名称标识 |
escape |
是 |
|
Boolean |
|
value |
否 |
|
Object |
值 |
- <s: set name= "personName" value= "person.name" />
- Hello, <s:property value= "#personName" />. How are you?