You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Smith Justin M <Sm...@JohnDeere.com> on 2004/01/12 17:34:01 UTC
Struts Tiles Double Post Issue
I am running into a problem with Struts Tiles. My action class is being executed twice when I submit a page.
I have a simple page like this.
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:form action="ViewOtherCustomerInformation">
<input type="submit" name="submit">
</html:form>
It executes the action that I define in my struts config.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- Form Beans -->
<form-beans>
<form-bean name="otherCustomerInformationActionForm" type="com.component.customer.admin.actionforms.OtherCustomerInformationActionForm"/>
</form-beans>
<!-- Global Forwards -->
<global-forwards>
<forward name="viewothercustomerinformation" path="/ViewOtherCustomerInformation?action="/>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<!-- Administration/Internal User mappings -->
<action path="/ViewOtherCustomerInformation"
type="com.component.customer.admin.actions.ViewOtherCustomerInformationAction"
name="otherCustomerInformationActionForm"
scope="request">
<forward name="show" path="admin.customerinformation"/>
</action>
</action-mappings>
<!-- Message Resources -->
<message-resources parameter="config.CustomerServiceResources"/>
<!-- Tiles Plugin Definition -->
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-def.xml"/>
<set-property property="definitions-debug" value="2"/>
<set-property property="definitions-parser-details" value="2"/>
<set-property property="definitions-parser-validate" value="true"/>
</plug-in>
</struts-config>
I am seeing the second execution happen when the <tiles:insert attribute="body" /> line gets called in the layout.jsp file.
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title><tiles:getAsString name="title"/></title>
<link rel="stylesheet" type="text/css" href="<html:rewrite page='/en_US/includes/css/cssstyle.css'/>">
<style>
<!--
body, td, li, font, a
{
Font-Family: Verdana, Arial, Helvetica, Sans-Serif;
font-size: 12px;
text-decoration: none;
}
//-->
</style>
</head>
<body bgcolor="#ffffff" background="#ffffff" link="#006600" vlink="#669966" alink="#669966" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0>
<A name="top"></a>
<A name="start"></a>
<!-- Header and NavBar -->
<tiles:insert attribute="header" />
<!-- Body -->
<center>
<table cellpadding="0" cellspacing="0" border="0" width="780">
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="5" valign="top">
<img src="/customeradmin/en_US/images/spacer.gif" height="1" width="5" alt="">
</td>
<td width="146" valign="top">
<tiles:insert attribute="leftnav" />
</td>
<td width="10" valign="top">
<img src="/customeradmin/en_US/images/spacer.gif" height="1" width="10" alt="">
</td>
<td width="614" valign="top">
<tiles:insert attribute="body"/>
</td>
<td width="5" valign="top">
<img src="/customeradmin/en_US/images/spacer.gif" height="1" width="5" alt="">
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
<!-- Footer -->
<tiles:insert attribute="footer" />
<a name="bottom"></a>
<a name="end"></a>
</body>
</html>
Any ideas why this is happening?
Is this normal?
Here is my tiles def xml file...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
<definition name="ABC" path="/layouts/layout.jsp">
<put name="title" value="Customer Service"/>
<put name="header" value="/en_US/includes/header.jsp"/>
<put name="leftnav" value="/en_US/includes/leftnav.jsp"/>
<put name="footer" value="/en_US/includes/footer.jsp"/>
<put name="body" value="/en_US/index.jsp"/>
</definition>
<definition name="noleftnav" path="/layouts/noleftnavlayout.jsp">
<put name="title" value="Customer Service"/>
<put name="header" value="/en_US/includes/header.jsp"/>
<put name="footer" value="/en_US/includes/footer.jsp"/>
<put name="body" value="/en_US/index.jsp"/>
</definition>
<definition name="admin.customerinformation" extends="ABC">
<put name="title" value="Customer Service"/>
<put name="body" value="/en_US/admin/customerinformation.jsp"/>
</definition>
</tiles-definitions>
Thanks...
Justin Smith
John Deere Credit
IT Analyst
515-267-3483
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org