File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts2 action from tiles definition fired multiple times Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 action from tiles definition fired multiple times" Watch "struts2 action from tiles definition fired multiple times" New topic
Author

struts2 action from tiles definition fired multiple times

Chan Yan
Greenhorn

Joined: Oct 21, 2005
Posts: 15
I am testing to fire a struts2 action from tiles definition (tiles-defs.xml). The action was fired, but it goes to infinite loop and can't stop. I notice it by adding a breakpoint in execute() method of ToHeaderAction.java, in debug mode. I think there is something wrong in web.xml but I don't know what is. Does anyboby help me to figure it out? thanks in advance.

I use Struts 2.1, tiles 2, tomcat 6, following jar files in the lib folder
struts-core-1.3.10.jar
struts2-core.2.1.6.jar
struts-tiles-plugin-2.0.11.1.jar
tiles-api-2.0.6.jar
tiles-core-2.0.6.jar
tiles-jsp-2.0.6.jar


below is the code.

web.xml

-----------
Struts xml

-------------

tiles-defs.xml

---------
index.jsp

------------

standard-layout.jsp

-------
siteHeaderTile.jsp

--------------
ToHeaderAction.java

---------------
MainPageAction.java

nobeltr ozgur
Greenhorn

Joined: Sep 20, 2009
Posts: 14
i m not obversing your code carefully

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="homepage.tiles" template="/layout/standard-layout.jsp">
<put-attribute name="header" value="/toHeader.action" />
<put-attribute name="body" value="/tiles/mainpage/main-body.jsp" />
</definition>

</tiles-definitions>

<put-attribute name="header" value="/toHeader.action" />
i think this line is wrong
you cant call action on tiles
edit:
and delete the one of them
struts-core-1.3.10.jar
struts2-core.2.1.6.jar
Chan Yan
Greenhorn

Joined: Oct 21, 2005
Posts: 15
Vertion 1 of Tiles used to be support to fire action (.do in struts 1) in tiles-defs.xml. For some reason, it doesn't works same way in tiles 2.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts2 action from tiles definition fired multiple times