• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 action from tiles definition fired multiple times

 
Chan Yan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic