Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

contextRelative="true" doesn't work in a module

Oren Livne

2007-03-22

Replies:

Dear All:

My application context is called "Catalog". It uses Struts 1.3.8. There
are two modules, "default" and "user". In the default component struts
config, I have:

    <!--
    ===============================================
    Global forwards (alias for main page, etc.).
    Needs to be placed in every module's Struts
    config unless we use XDoclet to merge
    a global global-forwards.xml file.
    ===============================================
   -->
   <global-forwards>

      <!-- Catalog component home page -->
      <!-- contextRelative=true doesn't seem to work from a local
action. -->
    <forward
    name="catalogHome"
    path="/switchMod.do?prefix=/catalog&amp;page=/home.do"
    redirect="true" />
   
      <!-- User component home page, which is also the application's
front page -->
    <forward
    contextRelative="true"
    name="userHome"
    path="/user/home.do"
    redirect="true" />

  </global-forwards>

Both methods work and forward to the correct URLs. However, I have the
identical global-forwards
in the user module's struts config. Now it forward to the wrong page
from an action in the user module.
The same result happened when I localized the forward to the action:

    <action
      path="/logout"
      type="net.ruready.struts.user.action.LogoutAction">
       <forward contextRelative="true"   name="userHome"
path="/user/home.do" redirect="true" />
    </action>

... it tries to forward to '/Catalog/user/user/home.do'. What do I do to
get it to work?

Thanks so much,
Oren

--
======================================================================
Oren Livne, Ph.D.
Research Assistant Professor of Mathematics
RUReady Software Architect

Academic Outreach and Continuing Education
1901 East South Campus Dr., Room 2197-D
University of Utah, Salt Lake City, UT 84112-9399
Tel : (801) 581-6831   Cell: (801) 631-3885   Fax: (801) 585-5414
Email: olivne@(protected)
======================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.