Hi,> Actually, my requirement is to populate the actionerrors object in
a Actionclass and display it in the JSP using <html:errors/> tag. I'm pasting the code which i use below:
In struts-config.xml i've the following:
-----------------------------------------------------------------
<action-mappings type="org.apache.struts.config.SecureActionConfig">
<action path="/Dummy" type="com.mountain.molehill.struts.actions.DummyAction" >
<forward name="Testing" path="/pages/body/DummyBody.jsp" />
</action>
</action-mappings>
-----------------------------------------------------------------
In struts-config-smile.xml i've the following:
-----------------------------------------------------------------
<action-mappings type="org.apache.struts.config.SecureActionConfig">
<action path="/Dummy" type="com.mountain.molehill.struts.actions.DummyAction" >
<forward name="Testing" contextRelative="true" path="/pages/body/DummyBody.jsp" />
</action>
</action-mappings>
-----------------------------------------------------------------
In web.xml i've the following: -------------------------------------------------------------------- <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>config/business</param-name> <param-value>/WEB-INF/struts-config-smile.xml</param-value> </init-param> --------------------------------------------------------------------
In DummyAction.java i've the following code: -------------------------------------------------------------------- public class DummyAction extends Action {
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionErrors errors1 = null; ActionError error1 = null; errors1 = new ActionErrors();
error1 =
new ActionError(
"MountainError",
"Populating the actionerrors in JSP using <html:errors/> tag");
errors1.add("Message", error1);
this.saveErrors(request, errors1); return (mapping.findForward("Testing"));
} } --------------------------------------------------------------------
In DummyBody.jsp, i've the following: -------------------------------------------------------------------- <%@ taglib uri="struts-html.tld" prefix="html" %>
<html:errors/>
--------------------------------------------------------------------
Now, when i access "/Dummy.do"( pointing to struts-config.xml) , i get the actionerrors added in action class, getting displayed in the JSP. But when i access "/business/Dummy.do" (pointing to struts-config-smile.xml), i do not get the actionerrors getting displayed in the JSP.
Comparing the action-mappings in struts-config.xml and struts-config-smile.xml, it's exactly the same, except that they belong to different modules( given in web.xml).
Can anybody tell me what's to be done to solve this problem?
FYI: I don't use message resource in this context.
Thanx, Norman
From: "Ashutosh Satyam" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: RE: Using multiple struts-config.xml- ActionErrors problem Date: Fri, 7 May 2004 12:32:36 +0530
I suspect your struts-config-smile.xml is having no message resource definition. Just add the same message resource definiton whatever you have in the default struts-config.xml. I hope it should work then.
This is how you define message resource bundle to be used in struts configuration file. +--------------------------------------------------------------+ | <!-- ========== Message Resources Definitions ========== --> | | <message-resources parameter="resources.application"/> | +--------------------------------------------------------------+
Cheers, Ashutosh Satyam
-----Original Message----- From: Normanjaisingh pauldurai [mailto:[EMAIL PROTECTED] Sent: Friday, May 07, 2004 12:23 PM To: [EMAIL PROTECTED] Subject: Using multiple struts-config.xml- ActionErrors problem
Hi,
I'm using struts-modular approach. i.e. in web.xml I've definitions like this
-------------------------
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/business</param-name>
<param-value>/WEB-INF/struts-config-smile.xml</param-value>
</init-param>
-------------------------
But when ActionErrors object is populated in "config/business" module,it is
not visible in the JSP page( i.e <html:errors/> tag doesn't display me the
errors populated). But the same works with "config" module. Why is this
problem.?
FYI: I use struts 1.1
Thanx in advance,
Norman
_________________________________________________________________ Post Classifieds on MSN classifieds. http://go.msnserver.com/IN/44045.asp Buy and Sell on MSN Classifieds.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Send flowers in 24 hours! http://www.fabmall.com/affiliatehtml/redir/nl7.asp At MSN Shopping.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Get head-hunted by 10,000 recruiters. http://go.msnserver.com/IN/35984.asp Post your CV on naukri.com today.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]