• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Preprocessing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Srikanth,
How do we do preprocessing using Struts? This is what I'm looking for, from the action page we send back the result using ActionMapping.findForward("") this eventually renders a jsp page, but that jsp page requires some preprocessing like retrieving data or cleaning up somethings. How do we do that?
Thanks,
-Babu
 
author
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Babu,
You should look at Struts Action Invocation Framework (SAIF) at struts.sourceforge.net
It lets you configure a interceptor stack for every Action. Each interceptor has two methods - beforeAction and afterAction. They are invoked before and after the Action's execute() method.
Hope this helps.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't this the point of the Action class itself?
The jsp (through a form or a link) calls an action to perform some process or select some data which is then either forwarded onto another Action or to a jsp.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use the requestprocessor if you want to do preprocessing. In the web.xml or struts.config you will find a requestprocessor class mentioned. Overwrite this one with your own (and change the config file) and then each request for an action does that pre-processing.
on the internet / or in struts documentation search for requestprocessor.
As usual this is not mentioned thoroughly in any of the books. So is it in this one ?
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like you guys are really complicating the initial question. It sounds to me like you have an action that currently forwards to a jsp page requiring cleanup or a data fetch. All you really need to go is make your action forward to another action (which will perform your preprocessing), and then that one can forward to your jsp page.
JSP -- submit ---> ACTION --- findForward("preprocess")----> PREPROCESS_ACTION ---- findForward("success")-----> JSP
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic