This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Struts with tiles - Urgent help needed.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ''.
***************************************************************
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change your struts-config.xml file to:

<action-mappings>
<action path="/mytest" forward="test" />
</action-mappings>
 
For Reg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the line:

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

You haven't defined a page with the name "Test".
 
For Reg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried your suggestion - did not help....
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!