Predeep,

I think you want to move your mapping from the web.xml to struts-config.xml
so your struts-config.xml has an action-mapping tag like this:

<action-mappings type="com.wiley.EmployeesActionMapping">
...
</action-mappings>

In Struts 1.2.X and onward, setting mapping, forward, and many other classes
will not work. I had a discussion on the list about it about 2 months ago
with Niall including replies.  Here is the last posting to that thread on a
discussion site (it also includes previous replies and some full details
after my remarks):
http://marc.theaimsgroup.com/?l=struts-user&m=109565277600317&w=2

In case you're wondering, I read a posting from a user trying to set those
things globally so I tried it and included example configuration details in
that thread on how to do it with ActionForwards.  It shouldn't be much
different doing it for ActionMappings.

Regards,
David

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 10, 2004 1:00 PM
To: Struts Users Mailing List
Subject: Re: Struts-Chain Roadmap and Inevitable Cocoon Analogy


Hi
I am pradeep Jain . Currently I am using  Struts 1.2.X . But I am facing
some problems.

1.I am trying to create my own action mapping but  in Action class when
ever I am  try to use that  it is giving me class cast exception .
following is my  web.xml

<servlet>
        <servlet-name>action</servlet-name>
 <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
                <param-name>debug</param-name>
                <param-value>5</param-value>
        </init-param>
        <init-param>( this is custome action mapping class)
                <param-name>mapping</param-name>
 <param-value>com.wiley.EmployeesActionMapping</param-value>
        </init-param>
        <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
</servlet>


But when in my action class ...
public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest request,HttpServletResponse response)
                                throws IOException, ServletException {
        ActionMapping mapping1 = mapping;
        System.out.println("***********mapping
.getclass"+mapping.getClass());
        EmployeesActionMapping employeesMapping
=(EmployeesActionMapping)mapping;( Here I am getting   class cast
exception )

...........

}


Please help in in resloving this ..

Thanks & regards
Pradeep Jain






Don Brown <[EMAIL PROTECTED]>
11/10/2004 12:55 PM
Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>


To
Struts Users Mailing List <[EMAIL PROTECTED]>
cc

Subject
Re: Struts-Chain Roadmap and Inevitable Cocoon Analogy






Well, you could do that with chain now by writing an action that
deferred handling to a particular chain, but I do like the sitemap
concept as evidenced by my porting of their wildcard matching to
Struts.

It might be interesting for an alternate struts-config format that
does allow us to stick chain commands right in struts-config rather
than having them defined somewhere else and have it look kinda like
ant:

<action-mapping path="edit*">
  <authorize type="{1}" />
  <retrieveFormData type="{1}" />
  <generateJsp path="/jsp/{1}.jsp" forward="success" />
</action-mapping>

Personally, however, I prefer something like struts-flow which allows
workflows to be defined in a more powerful scripting language.  These
XML mappings work great for simple cases, but don't really for the
more complex workflows you'd find in a real application.  I think that
was one of the main reasons why Struts developers insist on one Action
per request as Java is a much more capable workflow language than XML.

Don


On Wed, 10 Nov 2004 19:25:57 +0200, Emmanouil Batsis
<[EMAIL PROTECTED]> wrote:
> Don Brown wrote:
>
> >Well, pipelines won't work for Struts in the strictest sense, as they
> >rely on SAX and Struts isn't an XML transformation framework.
> >
> >
>
> Struts could use a sitemap thingy to pass a request along actions
> (without having the action choose an ActionForward). I guess that could
> work by consulting the sitemap object like
> mapping.findForward(sitemap.getForward(request));
>
> Manos
>
> ---------------------------------------------------------------------
>
>
> 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