Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

struts2常用标签(一)

$
0
0
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>WangFeng's test</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
  </head>
  
  <body>
    <s:property value="name"/><br/>
   
   <s:set var="list" value="{'zhangming','xiaoi','liming'}"/> 
   <s:iterator value="#list" status="st">
   		<font color=<s:if test="#st.odd">red</s:if><s:else>blue</s:else>>
   		<s:property /></font><br>
   </s:iterator>
   <br/>
   <s:set name="age" value="21" scope="request"/>
   <s:if test="#request.age==23">
		23
	</s:if>
	<s:elseif test="#request.age==21">
		21
	</s:elseif>
	<s:else>
		都不等
	</s:else>
	<s:br/>
	<s:url action="helloworld_add" namespace="/test"><s:param name="personid" value="#request.age"/></s:url> 
  </body>
</html>

不加scope:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>WangFeng's test</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
  </head>
  
  <body>
    <s:property value="name"/><br/>
   
   <s:set var="list" value="{'zhangming','xiaoi','liming'}"/> 
   <s:iterator value="#list" status="st">
   		<font color=<s:if test="#st.odd">red</s:if><s:else>blue</s:else>>
   		<s:property /></font><br>
   </s:iterator>
   <br/>
   <s:set name="age" value="21" />
   <s:if test="#age==23">
		23
	</s:if>
	<s:elseif test="#age==21">
		21
	</s:elseif>
	<s:else>
		都不等
	</s:else>    
  </body>
</html>


作者:howlaa 发表于2013-3-18 23:08:49 原文链接
阅读:69 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>