Hari,

I believe your web.xml mapping is incorrect.  I think it should be:

 <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

The modules should get figured out automatically.  What matters is the
struts ending (*.do).  The various config, config/module1, config/module2,
etc. should get figured out by the ONE ActionServlet automatically.  After
fixing that, your path http://www.yoursite.com/module1/HomeAction.do should
work fine.  Or, if it is inside a webapp,
http://www.yoursite.com/webapp/module1/HomeAction.do.

Regards,
David

-----Original Message-----
From: Hari Saptoadi [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 9:57 PM
To: Struts Users Mailing List
Subject: switch between module problem


hi all first i'd like to say sorry, if this already discussed before
i have problem with divide struts app into separate modules , i want to put
all jsp into different directory but not the action class and the form bean

and i did some like this below
myModule
-----------classes (all compiled class inlcuding action and form bean)
-----------public_html
                 ---------------MODULE1
                                                  Home.jsp
                                                  Result.jsp
                 ---------------MODULE2
                                                  Home2.jsp
                                                   Result.jsp
                ---------------WEB-INF
                                                  struts-config.xml
                                                  struts-config-module1.xml
                                                  struts-config-module2.xml
                                  ------lib
                                        and so on.....


and this is my web.xml

<web-app>
  <description>Empty web.xml file for Web Application</description>
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>config/MODULE1</param-name>
      <param-value>/WEB-INF/struts-config-module1.xml</param-value>
    </init-param>
    <init-param>
      <param-name>config/MODULE2</param-name>
      <param-value>/WEB-INF/struts-config-module2.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/MODULE1/*.do</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>
  <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
  </mime-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
</web-app>


this is my struts config

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
<struts-config>
   <global-forwards>
    <forward name="toModule1" contextRelative="true"
path="/MODULE1/Home.jsp" redirect="true"/>
    <forward name="toModule2" contextRelative="true"
path="/MODULE2/Index.jsp" redirect="true"/>
    <forward name="toIndex" path="/index.do"/>
  </global-forwards>
  <action-mappings>
    <action path="/toModule" type="org.apache.struts.actions.SwitchAction">
    </action>
  </action-mappings>
  <message-resources parameter="com.test.ApplicationResources"/>
</struts-config>

this is my struts-config-module1.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
<struts-config>
  <form-beans>
    <form-bean name="HomeActionForm" type="com.test.HomeActionForm"/>
    <form-bean name="IndexActionForm" type="com.test.IndexActionForm"/>
  </form-beans>
  <action-mappings>
    <action path="/HomeAction" type="com.test.HomeAction"
name="HomeActionForm" input="/Home.jsp" scope="request"/>
    <action path="/IndexAction" type="com.test.IndexAction"
name="IndexActionForm" input="/Index.jsp" scope="request">
     <forward name="hasil"  path="/Hasil1.jsp"/>
     <forward name="success"  path="/Home.jsp"/>
    </action>
  </action-mappings>
  <message-resources parameter="com.test.ApplicationResources"/>
</struts-config>

and i got this massage
javax.servlet.jsp.JspException: Cannot retrieve mapping for action
/HomeAction
        void org.apache.struts.taglib.html.FormTag.lookup()
                FormTag.java:871
        int org.apache.struts.taglib.html.FormTag.doStartTag()
                FormTag.java:543
        void _module1._Home._jspService(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
        [/MODULE1/Home.jsp]
                Home.jsp:16
        void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
                HttpJsp.java:139
        void
oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequ
est, javax.servlet.http.HttpServletResponse, java.lang.String)
                JspPageTable.java:317
        void
oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServl
etRequest, javax.servlet.http.HttpServletResponse)
                JspServlet.java:465
        void
oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletReques
t, javax.servlet.http.HttpServletResponse)
                JspServlet.java:379

did i miss something here.......
thank's for advance



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to