This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

How to do this without Action chaining...

 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I need is a simple action where a form is posted to, then chain to another action that points to a Tiles definition.

This is how I'm accomplishing it, but Struts Studio says this is "bad" Struts practice.
Here is the scenario:
* User clicks Add New and a blank form appears
* User fills in form and clicks submit
* Post is posted to ArticleAdd action
* Article is saved, then forwards to "list" which then forwards
to "ArticleList.do?method=list"
I forward to the ActionList.do because I need to re-read the DB to get the newly added record.
I can't very well forward to the JSP because the FormBean hasn't been updated with the new record. What I don't understand is why is this "bad practice" and if it is, what is the alternative?
I questioned the Struts Studio architect on this because they only allow forwards to JSP files or Tiles definitions, not to other actions.
 
author
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action chaining is a religiously debated aspect. Some swear by it, while others frown at it.
Here is my take:
There are some scenarios where Action Chaining is good and some scenarios where it is not so good.
The scenario you just described is a classic case where I would stick to Action Chaining. I think it is a great case for Action Chaining. There is no doubt in my mind. I describe almost a similar situation in my book too.
On the other hand, if the chaining is used for linking several units of business logic one after the other, it is better to do this in the business tier using a facade.
When some preprocessing is needed to show a page, irrespective of whether the page is shown for the first time in the normal way or through some other way (Like you had it - Add,edit,delete button). I would stick to Action Chaining in this case. But I can see that you dont have that liberty due to constraint in Struts Studio.
 
David Yutzy
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
I completely agree with the "business logic" scenario you described. But they actually put this in as a "business rule" and it flags my struts-confg.xml as invalid. What a head-ache in an otherwise great tool.
 
Anything worth doing well is worth doing poorly first. Just look at this 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!