You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kh...@leopard.com on 2003/03/06 19:25:47 UTC

any sample code on struts using sub modules that works?

Hello,

I'm trying to use sub modules with struts 1.1 release candidate 1.

But it's not working now.  It seems that struts cannot read other modules 
than struts-config.xml.  The error that I get "Cannot retrieve mapping for action /search/advancedSearch' "

Please let me know if you would happen to know a sample code out there to 
make this works.
Thank you!

/WEB-INF/struts-config.xml
/WEB-INF/modules/struts-config-search.xml
------------------------------------
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>config/search</param-name>
      <param-value>/WEB-INF/modules/struts-config-search.xml</param-value>
    </init-param>
------------------------------------
    <form-beans>
        <form-bean name="advanced-search" 
type="org.myclass.AdvancedSearchForm"/>
    </form-beans>

    <action-mappings>
        <action path="/advancedSearch"
                type="org.myclass.AdvancedSearchAction"
                name="advanced-search"
                input="/search/advanced.jsp"
                scope="request">
            <forward contextRelative="true" name="success" 
path="/success.jsp"/>
            <forward name="failure" path="/app/home/search/advanced.jsp"/>
        </action>
    </action-mappings>
------------------------------------
<html:form action="/search/advancedSearch.do">

        [bunch of form properties]

</html:form>


RE: any sample code on struts using sub modules that works?

Posted by James Mitchell <jm...@apache.org>.
I have a small app for demonstration.  I didn't write it, I only fixed
it for someone else with the same problem.

Unzip the attached file and add the jars (available in the distribution)
to /WEB-INF/lib, then deploy.

It demonstrates only one of several ways you can configure Struts to
jump back and forth between modules.

There are only 2 jsp pages, each linking to the other.  Within each page
is a value pulled from that modules resource bundle.

Have Fun!!!


--
James Mitchell
Web Developer/Struts Evangelist
http://jakarta.apache.org/struts/

"People demand freedom of speech to make up for the freedom of thought
which they avoid."
    - Soren Aabye Kierkegaard (1813-1855)




> -----Original Message-----
> From: khalim@leopard.com [mailto:khalim@leopard.com] 
> Sent: Thursday, March 06, 2003 1:26 PM
> To: 'Struts Users Mailing List'
> Subject: any sample code on struts using sub modules that works?
> 
> 
> Hello,
> 
> I'm trying to use sub modules with struts 1.1 release candidate 1.
> 
> But it's not working now.  It seems that struts cannot read 
> other modules 
> than struts-config.xml.  The error that I get "Cannot 
> retrieve mapping for action /search/advancedSearch' "
> 
> Please let me know if you would happen to know a sample code 
> out there to 
> make this works.
> Thank you!
> 
> /WEB-INF/struts-config.xml
> /WEB-INF/modules/struts-config-search.xml
> ------------------------------------
>     <init-param>
>       <param-name>config</param-name>
>       <param-value>/WEB-INF/struts-config.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>config/search</param-name>
>       
> <param-value>/WEB-INF/modules/struts-config-search.xml</param-value>
>     </init-param>
> ------------------------------------
>     <form-beans>
>         <form-bean name="advanced-search" 
> type="org.myclass.AdvancedSearchForm"/>
>     </form-beans>
> 
>     <action-mappings>
>         <action path="/advancedSearch"
>                 type="org.myclass.AdvancedSearchAction"
>                 name="advanced-search"
>                 input="/search/advanced.jsp"
>                 scope="request">
>             <forward contextRelative="true" name="success" 
> path="/success.jsp"/>
>             <forward name="failure" 
> path="/app/home/search/advanced.jsp"/>
>         </action>
>     </action-mappings>
> ------------------------------------
> <html:form action="/search/advancedSearch.do">
> 
>         [bunch of form properties]
> 
> </html:form>
> 
>