2、6 创建LoginAction.java,内容为:
package app;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {
LoginForm lf = (LoginForm) form;
if (lf.getLoginName().trim().equals(lf.getLoginPass().trim()))
return mapping.findForward("success");
else
return mapping.findForward("failure");
}
}
编译方法为(将struts-core-1.3.10.jar和servlet-api.jar文件放入当前目录):
javac -d . -classpath .;struts-core-1.3.10.jar;servlet-api.jar LoginAction.java
将编译后的包类放入WEB-INF\classes
2、7 新建struts-config.xml,放入WEB-INF目录下,内容为:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config SYSTEM "http://struts.apache.org/dtds/struts-config_1_3.dtd" >
<struts-config>
<form-beans>
<form-bean name="loginForm" type="app.LoginForm" />
</form-beans>
<action-mappings>
<action path="/login" type="app.LoginAction"
name="loginForm" validate="false" scope="request">
<forward name="success" path="/success.html" />
<forward name="failure" path="/failure.html" />
</action>
</action-mappings>
</struts-config>
2、8 创建success.html文件,内容为:
<HTML>
<HEAD>
<TITLE>SUCCESS</TITLE>
</HEAD>
<BODY>
Registration succeeded!
<P><A href="index.jsp">try another?</A></P>
</BODY>
</HTML>
2、9 创建failure.html文件,内容为:
<HTML>
<HEAD>
<TITLE>FAILURE</TITLE>
</HEAD>
<BODY>
Registration failed!
<P><A href="index.jsp">try again?</A></P>
</BODY>
</HTML>
2、10 即可运行,因为Tomcat自动缓存,所以每次修改后要及时将<Tomcat>\work目录下的内容清空
3 使用Eclipse创建Struts项目
3、1 新建动态网站项目
3、2 将必须的包放入WEB-INF\lib下,有
jstl.jar
standard.jar
commons-beanutils-1.8.0.jar
commons-chain-1.2.jar
commons-digester-1.8.jar
struts-core-1.3.10.jar
3、3 修改web.xml文件,如:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>webapp</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
3、4 新建登录网页index.jsp,内容为:
<%@ page language="java" c pageEncoding="ISO-8859-1"%>
<!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" c>
<title>Insert title here</title>
</head>
<body>
<form action="login.do" method="POST">
<input type="text" name="loginName">
<input type="password" name="loginPass">
<input type="submit" value="submit" >
</body>
</html>
3、5 创建LoginForm.java,内容为:
package app;
import org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm {
String loginName;
String loginPass;
public LoginForm() {
}
public LoginForm(String user, String pass) {
setLoginName(user);
setLoginPass(pass);
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getLoginPass() {
return loginPass;
}
public void setLoginPass(String loginPass) {
this.loginPass = loginPass;
}
}
也可以使用Eclipse的向导来自动生成
3、6 创建LoginAction.java,内容为:
package app;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {
LoginForm lf = (LoginForm) form;
if (lf.getLoginName().trim().equals(lf.getLoginPass().trim()))
return mapping.findForward("success");
else
return mapping.findForward("failure");
}
}
也可以使用Eclipse的向导来自动生成
3、7 新建struts-config.xml,可以采用XML生成向导,选择从DTD创建,选择“select XML catalog entry”,选择一个struts-config的DTD文件,内容为:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config SYSTEM "http://struts.apache.org/dtds/struts-config_1_3.dtd" >
<struts-config>
<form-beans>
<form-bean name="loginForm" type="app.LoginForm" />
</form-beans>
<action-mappings>
<action path="/login" type="app.LoginAction"
name="loginForm" validate="false" scope="request">
<forward name="success" path="/success.html" />
<forward name="failure" path="/failure.html" />
</action>
</action-mappings>
</struts-config>
3、8 创建success.html文件,内容为:
<HTML>
<HEAD>
<TITLE>SUCCESS</TITLE>
</HEAD>
<BODY>
Registration succeeded!
<P><A href="index.jsp">try another?</A></P>
</BODY>
</HTML>
3、9 创建failure.html文件,内容为:
<HTML>
<HEAD>
<TITLE>FAILURE</TITLE>
</HEAD>
<BODY>
Registration failed!
<P><A href="index.jsp">try again?</A></P>
</BODY>
</HTML>
3、10 即可运行(注意文件所在目录的正确)
如果出现找不到action的异常,可能原因在于配置文件struts-config.xml说明需要更改
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
3、11 使用Struts标签(见2使用Struts标签.rar)
1)添加struts-form.tld文件和struts-taglib-1.3.10.jar文件
2)修改index.jsp,内容为:
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form"%>
<form:form action="login.do">
UserName:<form:text property="loginName" />
<br>
enter password:<form:password property="loginPass" />
<br>
<form:submit value="Register" />
</form:form>
3)确认web.xml文件,加入<load-on-startup>2</load-on-startup>,如:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
4)即可运行
4 例子
4、1 一个最简单的struts程序
将jakarta-struts文件包中的struts-blank.war放于<Tomcat>\webapps下,即可运行为:
http://localhost:8088/struts-blank/index.jsp
或者拷贝至Eclipse工程中(见1Blank)
可以尝试添加中文属性文件,发现显示乱码
解决方法为:
native2ascii.exe -encoding GB2312 MessageResources_zh_CN.properties MessageResources_zh_CN.properties_new
将MessageResources_zh_CN.properties_new替换到MessageResources_zh_CN.properties
同时,修改Welcome.jsp,增加:<%@page c%>
(见2增加中文信息)
上述程序的运行过程为:
1)Web应用程序启动装载ActionServlet。
2)客户请求应用程序,默认为index.jsp,原因在于web.xml中有:
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
而index.jsp中有跳转代码,如:
<logic:redirect forward="welcome"/>
其中的“welcome”在struts-config.xml中有代码说明,如:
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
</global-forwards>
由于任何*.do请求都会由ActionServlet处理,所以用户请求转交到ActionServlet
3)ActionServlet将表单信息保存到ActionForm对象中,如果ActionForm对象不存在,则创建之。
根据配置信息决定是否需要表单验证,如果需要就调用ActionForm的validate方法。
4)如果验证错误,ActionServlet将直接把请求转发给包含客户提交表单的JSP组件。此时不会创建Action对象和调用Action对象的execute方法。
5)如果验证成功,ActionServlet从struts-config.xml中读取Action的映射信息,并存放到ActionMappings对象中,ActionServlet根据此配置信息决定将请求转发给哪个Action,如果Action不存在,则创建之并且调用它的execute方法。
6)Action对象的execute方法返回一个ActionForward对象,ActionServlet再把请求转发给ActionForward对象指向的JSP组件。
7)ActionForward对象指向的JSP组件生成网页,返回给客户。
4、2 修改此程序
有三个网页:Welcome.jsp、hello.jsp和loginerror.jsp。其中用户首先访问Welcome.jsp以登录,如果验证成功,转入hello.jsp,否则转入loginerror.jsp。
1)修改WEB-INF\classes\MessageResources.properties,添加文本信息,如:
# --helloapp
app.title=helloapp
app.username= User Name
app.password=Password
app.hello=Welcome
app.loginerror=Your username or password are invalid.
app.loginagain=Login Again
error.username=<font color="red">Please input username</font>
2)修改Welcome.jsp文件,为:
<%@ 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"%>
<html>
<head>
<title><bean:message key="app.title" /></title>
</head>
<body>
<html:errors />
<html:form action="login.do" method="POST">
<table>
<tr>
<td><bean:message key="app.username" />:</td>
<td><html:text property="username" /></td>
</tr>
<tr>
<td><bean:message key="app.password" />:</td>
<td><html:password property="password" /></td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html>
说明:
message标签可以读取application.properties中的文本信息。
form标签可以定义表单,并与ActionForm对应。
errors标签可以显示表单认证错误时的信息。
3)建立ActionForm类,为LoginForm,它的属性和login.jsp网页中表单输入参数对应,如:
package mypack;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
public class LoginForm extends ActionForm {
private String password = null;
private String username = null;
// Password Accessors
public String getPassword() {
return (this.password);
}
public void setPassword(String password) {
this.password = password;
}
// Username Accessors
public String getUsername() {
return (this.username);
}
public void setUsername(String username) {
this.username = username;
}
// This method is called with every request. It resets the Form
// attribute prior to setting the values in the new request.
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.password = null;
this.username = null;
}
public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
ActionErrors errors = new ActionErrors();
if (username == null || username.equals("")) {
errors.add("username", new ActionMessage("error.username"));
}
return errors;
}
}
要编译这个类,需要<Tomcat>\webapps\struts-blank\WEB-INF\lib\struts.jar文件
4)建立Action类,为LoginAction,它用于将请求进一步转发,如:
package mypack;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LoginAction extends Action {
protected String checkUser(String username, String password) {
String user = null;
// You would normally do some real User lookup here, but
// for this example we will have only one valid username "lsq"
if (username.equals("lsq") && password.equals("1234")) {
user = new String("Li Shuqing");
}
return user;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException,
ServletException {
String user = null;
// Default target to success
String target = new String("success");
// Use the LoginForm to get the request parameters
String username = ((LoginForm) form).getUsername();
String password = ((LoginForm) form).getPassword();
user = checkUser(username, password);
// Set the target to failure
if (user == null) {
((LoginForm) form).setUsername("username");
((LoginForm) form).setPassword("password");
target = new String("failure");
} else {
request.setAttribute("USER", user);
}
// Forward to the appropriate View
return (mapping.findForward(target));
}
}
要编译这个类,需要<Tomcat>\webapps\struts-blank\WEB-INF\lib\struts.jar文件
5)修改struts-config.xml文件,如:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<struts-config>
<form-beans>
<form-bean name="loginForm" type="mypack.LoginForm" />
</form-beans>
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward name="welcome" path="/Welcome.do" />
</global-forwards>
<action-mappings>
<action path="/Welcome" forward="/pages/Welcome.jsp" />
<action path="/login" type="mypack.LoginAction" name="loginForm"
scope="session" input="/pages/Welcome.jsp" validate="true">
<forward name="success" path="/pages/hello.jsp" />
<forward name="failure" path="/pages/loginerror.jsp" />
</action>
</action-mappings>
<message-resources parameter="MessageResources" />
</struts-config>
其中:
name="loginForm":Action处理的ActionForm名称
input="/login.jsp":如果ActionForm的validate方法返回错误,则把客户请求转发到这个网页
validate="true":为真表示ActionServlet调用ActionForm的validate方法
6)建立hello.jsp文件,用于显示用户信息,如:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<title><bean:message key="app.title" /></title>
</head>
<body>
<b><bean:message key="app.hello" />: <%= request.getAttribute("USER") %></b>
</body>
</html>
7)建立loginerror.jsp文件,如:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<title><bean:message key="app.title" /></title>
</head>
<body>
<b><bean:message key="app.loginerror" /> <a href="pages/Welcome.jsp"><bean:message
key="app.loginagain" /></a></b>
</body>
</html>
5)上述程序的完整运行流程说明如下:
启动
Welcome.jsp中的message标签从文件读取文本,并替换相应文字
form标签寻找session范围内的ActionForm(即LoginForm),此时不存在,所以忽略将ActionForm属性映射为表单文本框的过程
填写信息提交后,Web应用程序容器在Web.xml中寻找对应的ActionServlet,ActionServlet对象创建一个LoginForm对象,把客户提交的信息传递给他,并将此LoginForm对象保存在session范围内
ActionServlet调用LoginForm对象的validate方法,验证信息,如果失败,按照“input”中的信息返回
如果validate验证成功,ActionServlet继续寻找Action,查询条件为action path="/login",如果此Action实例不存在,创建之,并创建含有<action>配置信息的ActionMapping,然后调用LoginAction的execute方法。
如果没有通过execute验证,将LoginForm的属性设置好,调用ActionMapping的findForward方法,参数为failure,该方法从<action>中寻找name属性为failure的<forward>元素,返回ActionForward,它代表的Url为pages/loginerror.jsp网页。LoginAction把ActionForward对象返回给ActionServlet,ActionServlet再把客户请求转发给pages/loginerror.jsp。loginerror.jsp的message标签读取文本生成网页,并链接到Welcome.jsp,此时如果显示Welcome.jsp,form标签会再次寻找session范围内的ActionForm(即LoginForm),将ActionForm属性映射为表单文本框信息
如果通过execute验证,调用ActionMapping的findForward方法,参数为success,该方法从<action>中寻找name属性为success的<forward>元素,返回ActionForward,它代表的Url为pages/hello.jsp网页,LoginAction把ActionForward对象返回给ActionServlet,ActionServlet再把客户请求转发给hello.jsp,它的message标签读取文本生成网页
4、3 增加中文处理能力(见4Full中文)
增加MessageResources_zh_CN.properties(仍然使用native2ascii转换字符)
每个网页增加<%@page c%>
但是仍然解决不了表单输入的汉字乱码
增加过滤器类
package mypack;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class ChineseFilter implements Filter {
public void init(FilterConfig arg0) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GB2312");
chain.doFilter(request, response);
}
public void destroy() {
}
}
修改web.xml文件增加此过滤器
<filter>
<filter-name>chineseFilter</filter-name>
<filter-class>mypack.ChineseFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>chineseFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
5 Tiles
5、1 一般使用
1)直接新建Struts项目
所需的包有:
antlr-2.7.2.jar
commons-beanutils-1.8.0.jar
commons-chain-1.2.jar
commons-digester-1.8.jar
commons-logging-1.0.4.jar
commons-validator-1.3.1.jar
jstl.jar
oro-2.0.8.jar
standard.jar
struts-core-1.3.10.jar
struts-taglib-1.3.10.jar
struts-tiles-1.3.10.jar
2)新建模版网页layout.jsp:
<%@page c%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<title><tiles:getAsString name="title" /></title>
</head>
<body>
<table width=100% height=100%>
<tr>
<td colspan="2" width=100% height=10% bgColor="gray"><tiles:insert
attribute="header" /></td>
</tr>
<tr>
<td width="20%" height=80% valign="top" bgColor="#DDDDDD"><tiles:insert
attribute="menu" /></td>
<td align="left" width="80%" height=80% valign=top bgColor="#DDDDDD"><tiles:insert
attribute="body" /></td>
</tr>
<tr>
<td colspan="2" width=100% height=10% bgColor="gray"><tiles:insert
attribute="footer" /></td>
</tr>
</table>
</body>
</html>
3)新建其他相关网页header.jsp,menu.jsp,body.jsp,footer.jsp
4)修改主网页index.jsp:
<%@page c%>
<%@ 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"%>
<tiles:insert page="layout.jsp">
<tiles:put name="title" value="我的页面" />
<tiles:put name="header" value="header.jsp" />
<tiles:put name="menu" value="menu.jsp" />
<tiles:put name="body" value="body.jsp" />
<tiles:put name="footer" value="footer.jsp" />
</tiles:insert>
5)此时即可查看
5、2 高级使用
可以看到,如果有多个使用layout.jsp模板的JSP页面,都可以按着index.jsp页面的方式使用这个layout.jsp模板,而无须再重复编写象table这样的HTML元素
1)修改web.xml文件,为:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Struts Blank Application</display-name>
<!-- Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>tiles</servlet-name>
<servlet-class>
org.apache.tiles.servlet.TilesServlet
</servlet-class>
<init-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>/WEB-INF/tiles-def.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
2)在struts-config.xml尾部增加:
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
</plug-in>
3)在WEB-INF中新建tiles-defs.xml文件:
<?xml version="1.0" encoding="GBK" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://struts.apache.org/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="myLayout" path="/layout.jsp">
<put name="title" value="我的页面" />
<put name="header" value="/header.jsp" />
<put name="menu" value="/menu.jsp" />
<put name="body" value="/body.jsp" />
<put name="footer" value="/footer.jsp" />
</definition>
</tiles-definitions>
4)修改index.jsp文件:
<%@page c%>
<%@ 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"%>
<tiles:insert definition="myLayout">
</tiles:insert>
5)利用这种方法还可以快速得到新的模版
修改tiles-defs.xml文件:
<?xml version="1.0" encoding="GBK" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://struts.apache.org/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="myLayout" path="/pages/layout.jsp">
<put name="title" value="我的页面" />
<put name="header" value="/pages/header.jsp" />
<put name="menu" value="/pages/menu.jsp" />
<put name="body" value="/pages/body.jsp" />
<put name="footer" value="/pages/footer.jsp" />
</definition>
<definition name="yourLayout" extends="myLayout">
<put name="title" value="新的页面" />
</definition>
</tiles-definitions>
修改index.jsp文件:
<%@page c%>
<%@ 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"%>
<tiles:insert definition="yourLayout">
</tiles:insert>