Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts Preprocessing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
    Bookmark Topic Watch Topic
  • New Topic