Sunil Patil discusses three ways to extend Struts. You can create plugins to execute some business logic at application startup, create your own RequestProcessor if you want to execute some business logic at a particular point during the request-processing phase, or extend the ActionServlet class if you want to execute your business logic at either application startup or shutdown, or during request processing.
This article uses a sample Struts application to demonstrate how to extend Struts using each of these three approaches. Two of the most successful examples of Struts extensions are the Struts Validation framework and the Tiles framework.
Read more: Extending Struts
-
Extending Struts (13 messages)
- Posted by: Dion Almaer
- Posted on: November 11 2004 22:59 EST
Threaded Messages (13)
- Extending Struts by Artem Yegorov on November 12 2004 09:58 EST
- Extending Struts by Sunil Patil on November 12 2004 23:29 EST
-
What's the different between RequestProcessor and Action? by Roby Chen on November 14 2004 10:54 EST
- What's the different between RequestProcessor and Action? by Artem Yegorov on November 15 2004 05:51 EST
-
What's the different between RequestProcessor and Action? by Roby Chen on November 14 2004 10:54 EST
- Extending Struts by Sunil Patil on November 12 2004 23:29 EST
- BeeHive and PageFlows by Doug Dew on November 12 2004 10:27 EST
- Extending Struts by Abdeslam el Idrissi on November 13 2004 06:16 EST
- Struts Extention by Sergio Alem??n on February 22 2006 15:55 EST
- Extending Struts by Martin Anderson on November 15 2004 11:03 EST
- extending struts... by Ian Pojman on November 15 2004 14:09 EST
- Extending Struts by NullPtr ! on November 15 2004 21:48 EST
- Extending Struts by Martin Anderson on November 18 2004 05:27 EST
- using struts with FDF/PDF forms by Sriram Parthasarathy on November 16 2004 01:00 EST
- Plese Help! by Sergio Alem??n on February 24 2006 13:32 EST
-
Extending Struts[ Go to top ]
- Posted by: Artem Yegorov
- Posted on: November 12 2004 09:58 EST
- in response to Dion Almaer
I've done it for my project and it adds a lot of flexibility and added functionality to your applications while still conforming to the Struts compatibility specs.
I am glad that somebody has finally wrote an article that gives one an idea on how to do it without extensive trial and error way of figuring things out or looking that much at the Struts source.
Thanks, Sunil!
Artem D. Yegorov
http://www.activexml.org -
Extending Struts[ Go to top ]
- Posted by: Sunil Patil
- Posted on: November 12 2004 23:29 EST
- in response to Artem Yegorov
Thanks Artem for taking interest in extending struts article. Hope it is helpful.
Sunil -
What's the different between RequestProcessor and Action?[ Go to top ]
- Posted by: Roby Chen
- Posted on: November 14 2004 22:54 EST
- in response to Sunil Patil
That means ActionServlet is responsible for handling all of your requests to Struts. You can create a sub-class of the ActionServlet class if you want to do something at application startup or shutdown or on every request, but you should try creating a PlugIn or RequestProcessor before extending the ActionServlet class. Before Servlet 1.1, the Tiles framework was based on extending the ActionServlet class to decorate a generated response. But from 1.1 on, it's used the TilesRequestProcessor class.
In our project based on Struts Framework, we always extend our work by extending ActionServlet. The kind of session work can be done in the base ActionServlet. What's the different between extending RequestProcessor and ActionServlet? Why "you should try creating a PlugIn or RequestProcessor before extending the ActionServlet class" is reasonable? -
What's the different between RequestProcessor and Action?[ Go to top ]
- Posted by: Artem Yegorov
- Posted on: November 15 2004 17:51 EST
- in response to Roby Chen
You want to extend RequestProcessor if you want to change or extend behaviour of URI to action matching and Forward processing.
ActionServlet is extended if any additional initalization and actual raw request processing (not reuqest URI) is needed, like triggering some behaviour based on some request values and etc.
Sincerely,
Artem D. Yegorov
http://www.activexml.org -
BeeHive and PageFlows[ Go to top ]
- Posted by: Doug Dew
- Posted on: November 12 2004 10:27 EST
- in response to Dion Almaer
The PageFlows feature of the Apache BeeHive project is basically a big Struts extension. The PageFlows code contains examples of the techniques described by the author, as well as examples of more advanced Struts extension techniques.
BeeHive: http://incubator.apache.org/beehive/
Doug -
Extending Struts[ Go to top ]
- Posted by: Abdeslam el Idrissi
- Posted on: November 13 2004 06:16 EST
- in response to Dion Almaer
Extending Struts by changing the RequestProcessor or the ActionServlet is very risky. I think that extending Struts by adding the SpringFramework can be a better choice. -
Struts Extention[ Go to top ]
- Posted by: Sergio Alem??n
- Posted on: February 22 2006 15:55 EST
- in response to Abdeslam el Idrissi
i didn't understand the reason for i could extends struts framework to Spring Framework.
Can you explain it to me?
Thanks. -
Extending Struts[ Go to top ]
- Posted by: Martin Anderson
- Posted on: November 15 2004 11:03 EST
- in response to Dion Almaer
Nicely done. Having done both a custom solution and used struts, I feel that extending struts in this manner is incredibly powerful and under-used.<br><br>
Also very useful as I'm in the process of mentoring a team of newbies onto struts and trying to convince them of its usefulness over Model 1 vanilla JSPs, and this provides yet another excellent reason! -
extending struts...[ Go to top ]
- Posted by: Ian Pojman
- Posted on: November 15 2004 14:09 EST
- in response to Martin Anderson
I have found a fourth and best way to extend struts... you simply download webwork1 and delete all those nasty config files and dependency jars :) oh yes, and all that useless form code and servlet code... Ahhh, someone smack Jakarta with a POJO. seriously though, there is an extension to struts which makes the actions be non-reentrant. That solves a huge problem of struts off the bat. Sad Craig disagrees with a more sane model..... -
Extending Struts[ Go to top ]
- Posted by: NullPtr !
- Posted on: November 15 2004 21:48 EST
- in response to Martin Anderson
As another member suggested, u wud be better off convincing them of WebWork or Spring-MVC..Nicely done. Having done both a custom solution and used struts, I feel that extending struts in this manner is incredibly powerful and under-used.<br><br>Also very useful as I'm in the process of mentoring a team of newbies onto struts and trying to convince them of its usefulness over Model 1 vanilla JSPs, and this provides yet another excellent reason!
-
Extending Struts[ Go to top ]
- Posted by: Martin Anderson
- Posted on: November 18 2004 05:27 EST
- in response to NullPtr !
As another member suggested, u wud be better off convincing them of WebWork or Spring-MVC..
In a situation were you have J2EE developers on a J2EE system looking for an MVC framework that has a solid background, good documentation (standard docs and books), an excellent and supportive community and has more employment opportunities (220 v 3 on Jobserve this morning[18/11/04]), you have to go for Struts. On an enterprise system where object creation is an issue, especially on an early JVM, Struts will always score better than WW due to its architecture.
I’m a big fan of OpenSymphony, I think they do some great work (I always try to use clickstream for example), but I think that the big picture favours Struts at the moment. Even thought there are definitely issues such as ActionForm bloat, the market has gone for struts in a big way. I don’t know enough about Spring-MVC to comment but I believe that you can easily inter-op between a Struts presentation layer with a Spring mid-tier which would give you the best of both worlds. -
using struts with FDF/PDF forms[ Go to top ]
- Posted by: Sriram Parthasarathy
- Posted on: November 16 2004 01:00 EST
- in response to Dion Almaer
Any body can tell me whether can we use PDF forms instead of form in the jsp and struts. FDF toolkit allows us to extract the data filled in pdf forms - we normally use FDF toolkit and servlet to extract the same. But I m not too sure whether can I use this with struts framework.
if anybody can point some samples/articles on the same it will be great -
Plese Help![ Go to top ]
- Posted by: Sergio Alem??n
- Posted on: February 24 2006 13:32 EST
- in response to Dion Almaer
I was serching about build.xml file, to create .war with ANT. But, is possible the Eclipse generates autimatically this file. Can Eclipse generate automatically the build.xml file ???