常用的Struts2标签有:property/set/bean/include/fielderror/param/debug、控制标签有:if/else/elseif/iterator
以下为这几种标签的演示代码:

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding
="GB18030"
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Struts Tags</title>
</head>
<body>
<ol>
    
<li>property: <s:property value="username" /> | <s:property
        
value="password" /></li>
    
<li>property取值为字符串:<s:property value="'username'" /></li>
    
<li>property设定默认值:<s:property value="admin" default="管理员" /></li>
    
<li>property设定HTML:<s:property value="'<hr />'" escapeHtml="false" /></li>
    
<hr />
    
<li>set设定adminName值(默认为request和ActionContext)<s:set
        
var="adminName" value="username" /></li>
    
<li>set 从request取值:<s:property value="#request.adminName" /></li>
    
<li>set, Get value from ActionContext:<s:property
        
value="#adminName" /></li>
    
<li>set, Set range.<s:set var="adminPassword" value="password"
        scope
="page" /></li>
    
<li>set,Get value from this range:<%=pageContext.getAttribute("adminPassword")%></li>
    
<li>set,Set var,range is ActionContext.<s:set var="adminPassword"
        value
="'haha'" /></li>
    
<li>set,Use # get value:<s:property value="#adminPassword" /></li>
    
<hr />
    
<li>bean View debug description: <s:bean
        
name="com.bebig.struts2.tags.Dog" var="myDog">
        
<s:param name="name" value="'oydy'"></s:param>
    
</s:bean></li>
    
<li>include: <s:include value="/include1.html"></s:include></li>
    
<hr />
    
<li>fielderror: <s:fielderror name="field.test" theme="simple"></s:fielderror>
    
</li>
    
<hr />
    
<li>age=<s:property value="#parameters.age[0]" /> <s:set
        
var="age" value="#parameters.age[0]"></s:set> <s:if test="#age<0">error!</s:if>
    
<s:elseif test="#age<20">too young!</s:elseif> <s:else>ok.</s:else></li>
    
<hr />
    
<li>集合遍历:<br>
    
<s:iterator value="{1,2,3}">
        
<s:property />
        
<br>
    
</s:iterator></li>

    
<li>集合遍历:<br>
    
<s:iterator value="{1,2,3}" status="s">
        
<s:property />当前为第<s:property value="#s.count" />个元素,元素索引为<s:property
            
value="#s.index" />
        值为奇数?
<s:property value="#s.odd" />值为偶数?<s:property value="#s.even" />
        为第一个元素?
<s:property value="#s.first" />
        为最后一个元素?
<s:property value="#s.last" />
        
<br>
    
</s:iterator></li>

    
<li>集合遍历:<br>
    
<s:iterator value="{'aaa','bbb','ccc'}" var="list">
        
<s:property value="#list.toUpperCase()" />
        
<br>
    
</s:iterator></li>

    
<li>集合遍历:<br>
    
<s:iterator value="#{1:'aaa',2:'bbb',3:'ccc'}">
        
<s:property value="key" /> | <s:property value="value" />
        
<br>
    
</s:iterator></li>

    
<li>集合遍历:<br>
    
<s:iterator value="#{1:'aaa',2:'bbb',3:'ccc'}" var="map">
        
<s:property value="#map.key" /> | <s:property
            
value="#map.value.toUpperCase()" />
        
<br>
    
</s:iterator></li>
</ol>

<s:debug></s:debug>
</body>
</html>