wood burning stoves 2.0*
The moose likes Struts and the fly likes How to call strtus2 action from struts1 action in integrated project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to call strtus2 action from struts1 action in integrated project?" Watch "How to call strtus2 action from struts1 action in integrated project?" New topic
Author

How to call strtus2 action from struts1 action in integrated project?

PrasannaKumar maddu
Greenhorn

Joined: Sep 19, 2012
Posts: 3
Hi all,
I integrated struts1 and struts2 in one application.Now i am trying to call struts2 action from struts1 action class.Can you please tell me how to pass control from strtus1 to strtus2? .I have done by uing redirect action but in this case a new request and a new response are generating, it is not forwarding the exiting request object.Please let me know your valuable posts on this topic.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

In Struts 1, when you redirect you have redirect=true in the XML? If so, it is going a redirect instead of a forward.

The difference is that forward keeps the same request.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
PrasannaKumar maddu
Greenhorn

Joined: Sep 19, 2012
Posts: 3
I achieved it in the following way
I called Struts 2 Action From Struts 1 Using the following code. Its working fine.

Step1:
In web.xml add modify the strut2 filter mapping like in the following way:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

Step2:
Add the following code in side the struts-config.xmlTo forward action)
<action path="/helloWorldTwo" type="com.mkyong.common.action.HelloWorldActionTwo">
<forward name="success3" path="/home.action"/>
</action>

/home.action is configured inside the strtus.xml.
 
GeeCON Prague 2014
 
subject: How to call strtus2 action from struts1 action in integrated project?