Hello all,

 

I am somewhat new to struts and I'm attempting to create an application that
uses tiles.

I obviously have something configured incorrectly because I get a 404 error
when attempting to display my page.

Here's what I've done so far:

 

1)       Create a template jsp page called site.baseLayout.jsp located in my
jsp/common/layout directory

2)       Create all the jsp files referenced in the tiles-defs.xml file in
their appropriate locations.

3)       Create a tiles-defs.xml file located in my WEB-INF folder (contents
below)

<?xml version="1.0" encoding="ISO-8859-1" ?>

 <!DOCTYPE tiles-definitions PUBLIC

       "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"

       "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd";>

<tiles-definitions>

    <definition name="site.baseLayout"
path="jsp/common/layouts/baseLayout.jsp">

        <put name="title"  value="Base Title" />

        <put name="header" value="jsp/common/header.jsp" />

        <put name="menu"   value="jsp/common/leftnav.jsp" />

        <put name="footer" value="jsp/common/footer.jsp" />

        <put name="body"   value="jsp/common/body.jsp" />

    </definition>

    <definition name="home.page" extends="site.baseLayout">

        <put name="title"  value="Home Title" />

        <put name="body"   value="jsp/home/body.jsp" />

    </definition>

</tiles-definitions>

4)       Modify my struts-config.xml file to load the tiles plug-in,
reference the tiles-defs.xml file and create an action mapping that refers
to one of my tile definitions (struts-config.xml below)

<struts-config>

  <display-name><![CDATA[

     Web Application

  ]]>

  </display-name>

  <description><![CDATA[

     Handles all functionality for the website.

  ]]>

  </description>

  <!-- ========== Action Mapping Definitions ==============================
-->

  <action-mappings>

   <action

      path="/flc"

      type="org.apache.struts.actions.ForwardAction"

      parameter="home.page"

    />

  </action-mappings>

  <!-- ========== Controller Configuration ================================
-->

  <controller pagePattern="$M$P" inputForward="true" />

  <!-- ========== Plug Ins Configuration ==================================
-->

  <plug-in className="org.apache.struts.tiles.TilesPlugin" >

    <set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />

    <set-property property="definitions-parser-validate" value="true" />

    <set-property property="moduleAware" value="true" />

  </plug-in>  

</struts-config>

 

When attempt to view http://localhost/flc through a browser I get a 404
error. What did I do wrong??

 

Thanks,

Darren

Reply via email to