This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

 
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.
 
author & internet detective
Posts: 39890
798
Eclipse IDE VI Editor Java
  • 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.xml:(To 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.
 
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!