Struts2 通用标签之date标签的使用

版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/84954033

date标签 :目的就是规范化格式化

连接页面

 <%
   Date dd=new Date();
  session.setAttribute("dd", dd);
    %>
   <a href="gg.action">map栈</a>

显示页面

 <body>
  <!-- comparator="排序的方式" soure="集合名称" var="属性的名称" 代表的就是Comparator<Person>里面的属性-->
  <s:sort comparator="#request.com" source="list" var="pp">
  <!--  value="#attr.person" 循环遍历的对象-->
  <s:iterator value="#attr.pp"  >
  ${name }--
  ${age }<br>
  </s:iterator>
  </s:sort>
  时间标签
  <s:date name="#session.dd" var="da" format="yyyy/MM/dd hh:mm:ss" />
  时间:${da }
 
  </body>

struts.xml配置

<action name="gg" class="cn.com.action.Person" method="execute">
<!-- result="名称" 当名称是error的时候,代表着对应的是<result name="error"></result>这个信息;exception="异常全类名"-->
<!-- <exception-mapping result="error" exception="java.lang.ArithmeticException">

</exception-mapping> 
<result name="error">/context.jsp</result> -->
<result name="success">/sort.jsp</result>
</action>

猜你喜欢

转载自blog.csdn.net/qq_37591637/article/details/84954033