<%@ page language="java" import="accp.Student,java.util.*" pageEncoding="GBK"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html lang="true"> <head> </head> <body> This a struts page. <br> <% session.setAttribute("username","34"); %> <logic:empty name="username" scope="session"> username is null </logic:empty> <logic:equal value="23" name="username"> the age is 23 </logic:equal> <% java.util.ArrayList at=new java.util.ArrayList(); at.add("tom"); at.add("tom2"); at.add("tom3"); at.add("tom4"); request.setAttribute("SN",at); %> <logic:iterate id="element" name="SN" > <bean:write name="element" /> </logic:iterate> <% java.util.ArrayList at2=new java.util.ArrayList(); Student s1=new Student(); s1.setSalary(1234.567); s1.setMyTime(new Date()); Student s2=new Student(); s2.setSalary(1234.666); s2.setMyTime(new Date()); Student s3=new Student(); s3.setSalary(1234.333); s3.setMyTime(new Date()); at2.add(s1); at2.add(s2); at2.add(s3); session.setAttribute("AT2",at2); %> <logic:iterate id="myTemp" name="AT2"> <bean:write name="myTemp" property="salary" format="#####.#"/> <bean:write name="myTemp" property="myTime" format="yyyy年MM月dd日"/> </logic:iterate> </body> </html:html>