aspose file tools*
The moose likes Struts and the fly likes Struts with tiles  - Urgent help needed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with tiles  - Urgent help needed." Watch "Struts with tiles  - Urgent help needed." New topic
Author

Struts with tiles - Urgent help needed.

For Reg
Greenhorn

Joined: Apr 10, 2006
Posts: 4
I am trying to test a simple jsp by configuring struts & tiles.

When I invoke the action in the browser, I get a HTTP 404 message.
I don't see any error message in the console.


Help?


The tiles-defs.xml reads:
***************************************************************
<definition name="mylayout" path="mylayout.jsp">
<put name="bodycontent" value="body_content.jsp"/>
<put name="bodytopbar" value="topbar.jsp"/>
<put name="header" value="header.jsp"/>
<put name="footer" value="footer.jsp"/>
<put name="menu" value="menu_common.jsp"/>
</definition>

<!-- App entries -->

<definition name="test" extends="mylayout" >
<put name="title" value="Test"/>
<put name="bodycontent" value="newtest.jsp"/>
<put name="menu" value="menu_app.jsp"/>
</definition>
***************************************************************




The struts config.xml reads:
***************************************************************
<action-mappings>
<action path="/mytest" forward="a" />
</action-mappings>

.
.
.
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="definitions-debug" value="2" />
<set-property property="definitions-parser-details" value="2" />
<set-property property="definitions-parser-validate" value="true" />
<set-property property="moduleAware" value="true" />
</plug-in>



***************************************************************




When I invoke
http://localhost:9095/appdev/mytest.do, I get HTTP 404 message.

The console output is:

***************************************************************
[4/10/06 10:31:36:776 EDT] 3340306e WsServer A WSVR0001I: Server server1 open for e-business
[4/10/06 10:31:44:167 EDT] 3d75f06c WebGroup I SRVE0180I: [FICSWeb] [/ficsdev] [Servlet.LOG]: ActionServlet: init
[4/10/06 10:31:44:237 EDT] 3d75f06c PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[4/10/06 10:31:44:247 EDT] 3d75f06c PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[4/10/06 10:31:45:238 EDT] 3d75f06c TilesPlugin I org.apache.struts.tiles.TilesPlugin Tiles definition factory loaded for module ''.
[4/10/06 10:31:45:298 EDT] 3d75f06c TilesRequestP I org.apache.struts.tiles.TilesRequestProcessor Tiles definition factory found for request processor ''.
***************************************************************
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Change your struts-config.xml file to:

<action-mappings>
<action path="/mytest" forward="test" />
</action-mappings>


Merrill
Consultant, Sima Solutions
For Reg
Greenhorn

Joined: Apr 10, 2006
Posts: 4
That was a typo from my side...

Infact I have the right definition name - and inspite of that I am getting the same result....

Help again?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Remove the line:

<put name="title" value="Test"/>

You haven't defined a page with the name "Test".
For Reg
Greenhorn

Joined: Apr 10, 2006
Posts: 4
Tried your suggestion - did not help....
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi
In my struts-config.xml mapping for the tiles will be as follows
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/config/tiles/tiles-defs.xml"/>
<set-property
property="moduleAware"
value="true" />
</plug-in>

Now in the tiles-def.xml file
define the definition as follows
<definition name="/template.tile" page="/pages/layout/basic_template.jsp">
<put name="header" value="/pages/includes/header.jsp" />
<put name="menu" value="/pages/includes/menu.jsp" />
<put name="content" value="/pages/replaceme.jsp" />
<put name="footer" value="/pages/include/footer.jsp" />
</definition>

now in my struts class i have an action mapping in which i have a forward as follows
<action
path="/logon"
type="org.actions.LogonAction"
name="logonForm"
input="/pages/standard/logon.jsp"
scope="request">
<forward name="success" path="/homepage.tile" />
<forward name="failure" path="/pages/standard/logon.jsp" redirect="true"/>
</action>

The path given in the forward /homepage.tile is mapped to the tiles definition i have created in my tiles-def.xml as follows
<definition name="/homepage.tile" extends="/template.tile">
<put name="content" value="/pages/standard/home.jsp" />
</definition>

Hope this sample will help you

regards
Poornima
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts with tiles - Urgent help needed.