This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Error:ActionMappings not found for second module Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error:ActionMappings not found for second module" Watch "Error:ActionMappings not found for second module" New topic
Author

Error:ActionMappings not found for second module

Sana Jay
Greenhorn

Joined: Feb 03, 2004
Posts: 26
hi,
i am a newbie to struts.
i have 2 modules..and one struts-config file for each.
a)the default struts-config.xml for one module
b)another struts-config-TaxGroup.xml for the TaxGroup module
But iam getting the error when i am accesing the second module(TaxGroup)
as cant find actionmapping for /confirmAddTaxGroup(this is the uri). i dont know where is the error..plz guide me
Only the default module is accessed fine.
My struts-config-TaxGroup file is
<?xml version="1.0" encoding="ISO-8859-1" ?> <!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>
<!--TAXGROUP-->
<form-bean name="TaxGroupActionForm" type="kb.tax.taxgroup.TaxGroupActionForm"/>
</form-beans>
<global-forwards>
<!--TAXGROUP-->
<forward name="RegTaxGroup" path="/TaxGroup/RegTaxGroup.jsp"/> <forward name="ConfirmAddTaxGroup" path="/TaxGroup/ConfirmAddTaxGroup.jsp"/>
</global-forwards>
<action-mappings>
<!--TAX GROUP-->
<action path="/ConfirmAddTaxGroup" type="kb.tax.taxgroup.TaxGroupAction" name="TaxGroupActionForm" scope="session" input="/TaxGroup/RegTaxGroup.jsp" parameter="ConfirmAddTaxGroup">
</action>
</action-mappings>
</struts-config>
and in web.xml the relevant portion is
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/TaxGroup</param-name> <param-value>/WEB-INF/struts-config-TaxGroup.xml</param-value>
</init-param>

i have my jsp pages in /TaxGroup for the second module
And the <html:form action="/ConfirmAddTaxGroup">in the RegTaxGroup.jsp

Is my web.xml fine?
thanks in advance
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi,
Usually when we use modules in struts only your jsps related to that perticular module is seperated. All your configuration files and other classes will be in your default module.

This is a small example i did using two congig file.
I have one default module where i have login and menu page and. Apart from that i have one more module called registration where i have my register.jsp file resides. Action class related to this is mapped in a configuration file called
struts-config0reg.xml and the first classed are mapped into default configuration file .
Lets see the mapping i have done
defaultFile
=======
<struts-config>
<form-beans>
<form-bean name="loginForm" type="mypackage3.LoginFormBean"/>
</form-beans>
<action-mappings>
<action path="/login" type="mypackage3.LoginAction" name="loginForm" input="/login.jsp" scope="request">
<forward name="success" path="/menu.jsp"/>
</action>
</action-mappings>
<message-resources parameter="mypackage3.ApplicationResources"/>
</struts-config>
=====
Second config file
====
<struts-config>
<form-beans>
<form-bean name="RegFormBean" type="org.apache.struts.action.DynaActionForm" dynamic="true">
<form-property name="name" type="java.lang.String"/>
<form-property name="address" type="java.lang.String"/>
</form-bean>
</form-beans>
<action-mappings>
<action path="/save" type="mypackage2.RegAction" input="/registration.jsp">
<forward name="success" path="/display.jsp"/>
</action>
</action-mappings>
<message-resources parameter="mypackage2.ApplicationResources"/>
</struts-config>

This is the way i am mapping. Your web.xml mapping is correct.
In www.onjava.com site they have given how to use multiple configuration file . You will get information from jakarta site also. Mainly we use
switchAction class . In onjava. com they have given how to use this class.
Hope this will help you
all the best
poornima
Sana Jay
Greenhorn

Joined: Feb 03, 2004
Posts: 26
hi poornima,
My action-mappings of second module TaxGroup is found in my second struts-config file named as struts-config-TaxGroup.xml just like in ur regform module.
I am unable to find any difference between regform config file and taxgroup config file.Am i not doin the same thing.Plz Clarify.
Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error:ActionMappings not found for second module
 
Similar Threads
Cannot find ActionMappings or ActionFormBeans collection
error while using 2 strut-config files for 2 modules.plz guide
need help in web.xml
Error while deploying struts application
java.lang.NullPointerException: Module 'null' not found