Yes you're right - the warning comment implies you can configure it for the
controller - this comment should have been removed. You could do this in
Struts 1.0 - i.e. set a "forward" parameter in the web.xml to configure the
Forward implementation to use - but this behaviour was removed in Struts 1.1
(see revision 1.83 of ActionServlet) although comments at the start of
ActionServlet indicate that they are just deprecated.

Sorry when I read your original message I didn't realize theat  using the
global-forwards type="..."  mechanism in the struts-config didn't suit your
needs and you wanted to do it for the whole Struts app.

There is still a way to do it, but its not quite as straight forward as it
was. Haven't actually done this myself but I believe if  you create your own
custom ModuleConfigFactory you can then set the default ForwardConfig class
for every ModuleConfig when they are created.

public class MyModuleConfigFactory extends DefaultModuleConfigFactory {

    public ModuleConfig createModuleConfig(String prefix) {
        ModuleConfig config = super.createModuleConfig(prefix);
        config.setActionForwardClass("myPackage.MyForwardConfig");
        return config;
    }
}

Then in the web.xml you can configure struts to use your custom factory

  <servlet>
      <init-param><param-name>configFactory</param-name>

<param-value>myPackage.MyModuleConfigFactory</param-value>
      </init-param>

If you try this can you post back whether it worked or not.

Niall

----- Original Message ----- 
From: "David G. Friedman" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, September 19, 2004 2:47 PM
Subject: RE: ??? STRUTS 1.2.4 FEEDBACK ???


> I thought it meant ActionServlet and therefore web.xml init-param settings
> like "config" and a few other parameters:
>
> > "forward" initialization parameter to the Struts
> >                      controller servlet.
>
> I tried it in the stuts-config.xml as an attribute in the "controller" but
> received this error on 1.2.4:
>
> [ERROR] Digester - Parse Error at line 71 column 4: Attribute "forward"
must
> be declared for element type "controller". <org.xml.sax.SAXParseException:
> Attribute "forward" must be declared for element type
> "controller".>org.xml.sax.SAXParseException: Attribute "forward" must be
> declared for element type "controller".
>
> My line 74 is:
> <controller processor="org.apache.struts.action.RequestProcessor"
> contentType="text/html"
> forward="com.friedsoftware.struts.ActionForwardExample"
> />
>
> I tried a set-property and that also failed:
>
> <controller processorClass="org.apache.struts.action.RequestProcessor"
> contentType="text/html">
> <set-property property="forward"
> value="com.friedsoftware.struts.ActionForwardExample" />
> </controller>
>
> With the error:
>
> [ERROR] ActionServlet - Parsing error processing resource path
> /WEB-INF/struts-config.xml <java.lang.NoSuchMethodException: Bean has no
> property named forward>java.lang.NoSuchMethodException: Bean has no
property
> named forward
>
> So where do I put it to configure it for the "Struts controller servlet"
per
> the quote from the tld?  I also don't see any notes about those 3 in the
> docs for userGuide/configuration.html or
userGuide/building_controller.html.
> Nor did I notice what I was looking for when I was doing a quick find/grep
> on the source code for 1.2.4 (nothing jumped out at me).  This is the same
> class I can use successfully with a global-forwards type="..." attribute.
>
> Regards,
> David
>
> -----Original Message-----
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 19, 2004 3:09 AM
> To: Struts Users Mailing List
> Subject: Re: ??? STRUTS 1.2.4 FEEDBACK ???
>
>
> David,
>
> I believe you're mistaken, these comments relate to the struts-config.xml
> and not the web.xml and they work for me as described in Struts 1.2.4
>
>  <global-forwards type="com.friedsoftware.struts.ActionForwardExample">
>       <forward name="success" path="/index2.jsp">
>            <set-property property="property" value="welcome"/>
>       </forward>
> </global-forwards>
>
> Niall
>
> ----- Original Message -----
> From: "David G. Friedman" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Sunday, September 19, 2004 6:56 AM
> Subject: RE: ??? STRUTS 1.2.4 FEEDBACK ???
>
>
> > Niall,
> >
> > While researching (out of curiosity) a recent help request on how to use
> > custom ActionForwards with set-property, I actually read the
> > struts_config_1_2.tld and the ActionServlet class (from CVS). I found
that
> > the tld describes how to set various init-params in web.xml for
> > ActionServlet which don't seem to exist anymore.  There are no
references
> as
> > the tld comments describe in the 1.2.4 userGuide\configuration.xml or
the
> > latest ActionServlet.java code. Maybe no one remembered it was an odd
> > comment in the 1.2 (v 1.8) tld?  Below are the 3 comment sections
> including
> > their seemingly obsolete notes on init params:
> >
> > <!-- The "global-forwards" element describes a set of ActionForward
> objects
> >      [org.apache.struts.action.ActionForward] that are available to all
> > Action
> >      objects as a return value. The individual ActionForwards are
> configured
> >      through nested <forward> elements. An <action> element may override
a
> > global
> >      forward by defining a local <forward> of the same name.
> >
> >      type            Fully qualified Java class to use when
instantiating
> >                      ActionForward objects.  If specified, the object
must
> > be a
> >                      subclass of the default class type.
> >
> >                      WARNING:  For Struts 1.0, this value is ignored.
You
> >                      can set the default implementation class name with
> the
> >                      "forward" initialization parameter to the Struts
> >                      controller servlet.
> > -->
> >
> > <!-- The "action-mappings" element describes a set of ActionMapping
> objects
> >      [org.apache.struts.action.ActionMapping] that are available to
> process
> >      requests matching the url-pattern our ActionServlet registered with
> the
> >      container. The individual ActionMappings are configured through
> nested
> >      <action> elements. The following attributes are defined:
> >
> >      type           Fully qualified Java class to use when instantiating
> >                     ActionMapping objects. If specified, the object must
> be
> > a
> >                     subclass of the default class type.
> >
> >                     WARNING:  For Struts 1.0, this value is ignored.
You
> >                     can set the default implementation class name with
the
> >                     "mapping" initialization parameter to the Struts
> >                     controller servlet.
> > -->
> >
> > <!-- The "form-beans" element describes the set of form bean descriptors
> for
> > this
> >      module. The following attributes are defined:
> >
> >      type            Fully qualified Java class to use when
instantiating
> >                      ActionFormBean objects. If specified, the object
must
> > be a
> >                      subclass of the default class type.
> >
> >                      WARNING:  For Struts 1.0, this value is ignored.
You
> >                      can set the default implementation class name with
> the
> >                      "formBean" initialization parameter to the Struts
> >                      controller servlet.
> > -->
> >
> > Regards,
> > David
> >
> > -----Original Message-----
> > From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 16, 2004 12:16 AM
> > To: Struts Users Mailing List
> > Subject: ??? STRUTS 1.2.4 FEEDBACK ???
> >
> >
> > Has anyone tried out Struts 1.2.4?
> >
> > If so can you feedback - positive or negative.
> >
> > Niall
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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]
>
>



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

Reply via email to