struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: struts-config.xml problem/question (please help!)
Date Tue, 03 Oct 2000 22:32:43 GMT
Mike La Budde wrote:

> I''m in the process of converting from a home-grown Model-2 architecture to
> the struts framework. In my ActionServlet config file I used to just
> specify the name of the PATH and the FORWARD without having to fully
> qualify either relative to the context's root directory.
>
> For example, here's the directory structure (starting at
> ../webapps/mycontext/) :
>
> - pages
> |
> - - - - - - /inventory
> |
> - - - - - - /orders
>
> And here's a snippet from my new config file:
>
>     <!-- Inventory Actions -->
>     <action path="/pages/inventory/InventoryActionSearchPage"
>             type="com.xyz.inventory.InventoryActionSearchPage">
>         <forward
> name="success"             path="/pages/inventory/inventorySearch.jsp"/>
>     </action>
>
>     <action path="/pages/inventory/InventoryActionListPage"
>             type="com.xyz.inventory.InventoryActionListPage">
>         <forward
> name="success"             path="/pages/inventory/inventoryList.jsp"/>
>     </action>
>
>     <action path="InventoryActionViewPage"
>             type="com.xyz.inventory.InventoryActionViewPage">
>         <forward
> name="success"             path="/pages/inventory/inventoryRow.jsp"/>
>     </action>
>
> My question is: Why do I have to specify full path locations to everything?
> How are others doing this? Of course, keeping everything in the context's
> root would eliminate this problem (while creating a new one)....
>

If "/pages" is the context path for your web application, you do *not*
want to
include it in the paths inside action.xml.  The paths here are all
context-relative (in other words, they conform to the same requirements
as the
argument to ServletContext.getRequestDispatcher()).

So, for example, the last example in your new file should read:

    <action path="InventoryActionViewPage"
      type="com.xyz.inventory.InventoryActionViewPage">
        <forward name="success" path="/inventory/inventoryRow.jsp"/>
    </action>

>
> TIA,
>
> Mike

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

Mime
View raw message