• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
PrasannaKumar maddu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
PrasannaKumar maddu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic