• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts with tiles - Urgent help needed.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried your suggestion - did not help....
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic