Problem with Struts' SwitchAction  
Author Message
Boris Bresic





PostPosted: 2003-12-29 19:58:00 Top

java-programmer, Problem with Struts' SwitchAction Hi all!

I have problem with SwitchAction. Simplified workflow is following:

- main module (struts-config.xml):

/start.do (SwitchAction, passed params: prefix=/module1; page=/search.jsp)

This action is used to properly enter Struts framework.

- /module1 module (struts-config-module1.xml):

Form in search.jsp submits to the following action:

/module1/search.do (SwitchAction, passed params: prefix=/search;
page=/search.do)

This action switches to the search module.

- /search module (struts-config-search.xml):

/search/search.do (SearchAction)

SearchAction is custom action and it forwards to the another SwitchAction in
the /search module (/search/performSearch.do). SwitchAction params are added
within SearchAction to the path.

/search/performSearch.do (SwitchAction passed params: prefix=/module1;
page=/performSearch.do)

Now here occurs the problem. When SwitchAction of the
/search/performSearch.do action seeks for prefix param from the request
object, it gets old value "/search". Somehow value "/module1" is lost,
although I have set it in the SearchAction. This results with infinite loop,
because Struts does not switch from /search module to /module1 module and
/performSearch exists in both modules.

So, somehow when I chain my SearchAction and SwitchAction, new value of the
prefix param which is passed to the SwitchAction is lost.

Platform is WSAD 5.1.

Thanks,

BB