Well, you can't call a servlet from an Action with a Java method call but you can easily forward the request to the servlet from the action. I suggest creating a local or global forward element for the servlet.

<action path="/MyAction"
        type="com.foo.MyAction">
    <forward name="LegacyServlet" path="/path/to/old/servlet"/>
</action>

Then in the MyAction.execute() ...

  // business logic
  //...
  // now forward to old servlet
  return mapping.findForward("LegacyServlet");
}

Comprande?

Shilpa Nalgonda wrote:

i have  a shopping cart struts application, when update button of a jsp is
clicked, some action is performed and after the successful excution of that
action, a servlet which takes certain parameters should be called from the
action class.

The servlets which i am talking about are non-struts based and are already
implemented, and it would take much time to redo those using struts, so i am
wondering if there is any way to reuse those and call those servlets from
actions class.





-----Original Message-----
From: Jim Barrows [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 4:33 PM
To: Struts Users Mailing List
Subject: RE: Servlet help for a Struts programmer





-----Original Message-----
From: Michael McGrady [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 1:22 PM
To: Struts Users Mailing List
Subject: Re: Servlet help for a Struts programmer


At 12:57 PM 8/10/2004, you wrote:

Yes, Struts is based on Servlets, but you don't have to know
anything about Servlets to make a useful Struts webapp.

I wonder if this is true. I cannot imagine that it could be. Maybe it is. I am beginning to think so. ///;-)


Try it yourself.... no JSP's.  No struts, and basic CRUD operations on an
address book.

Now today, you would probably be smart.  You would have a CRUD servlet for
the "actions", that would redirect to a servlet for generating HTML.  That's
4 serlvets handling CRUD, one servlet to generate the add/edit form page,
one servlet to generate the list address page.

And no, you don't get to use jakarta's ECS either!!!  Nope.  Not at all..
you can however drool over it :)

out.println( "<html>");
        out.println( "<head>");
                out.println( "<title>THis is the title of my page.</title>");
        <out.println( "</head>");

Or:

out.println( "<html>"
                +"<head>"
                +"  <title>This is the title of my page.</title>");
                +"</head>");


--------------------------------------------------------------------- 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