You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shilpa Nalgonda <sn...@mypublisher.com> on 2004/08/26 19:36:55 UTC

can a non struts application be called from inside stuts application.

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:jbarrows@sssc.com]
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:mike@michaelmcgrady.com]
> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: can a non struts application be called from inside stuts application.

Posted by Erik Weber <er...@mindspring.com>.
ActionForward forward = mapping.findForward("LegacyServlet");
String path = forward.getPath();
path += "?param=value";
return new ActionForward(path);


Erik


Shilpa Nalgonda wrote:

>The old servlets takes lots of parameters, how and where can i pass those
>parameters in struts config...
>
>-----Original Message-----
>From: news [mailto:news@sea.gmane.org]On Behalf Of Bill Siggelkow
>Sent: Thursday, August 26, 2004 1:59 PM
>To: user@struts.apache.org
>Subject: Re: can a non struts application be called from inside stuts
>application.
>
>
>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:jbarrows@sssc.com]
>>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:mike@michaelmcgrady.com]
>>>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: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: can a non struts application be called from inside stuts application.

Posted by Shilpa Nalgonda <sn...@mypublisher.com>.
The old servlets takes lots of parameters, how and where can i pass those
parameters in struts config...

-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Bill Siggelkow
Sent: Thursday, August 26, 2004 1:59 PM
To: user@struts.apache.org
Subject: Re: can a non struts application be called from inside stuts
application.


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:jbarrows@sssc.com]
> 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:mike@michaelmcgrady.com]
>>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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: can a non struts application be called from inside stuts application.

Posted by Bill Siggelkow <bi...@bellsouth.net>.
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:jbarrows@sssc.com]
> 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:mike@michaelmcgrady.com]
>>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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org