Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error:ActionMappings not found for second module

 
Sana Jay
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic