Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Another way to go (cheap if you are coding right now, expensive if you've already coded everything) would be to modularize every action you have to perform in one single Struts2 Action.</p> <p>Then you will have something like an <code>BaseReportAction</code>, containing all the common attributes and methods shared using <code>protected</code> instead of <code>private</code>, doing your tuning on parameters and the common operations in the <code>execute()</code> method; </p> <p>And one Action for each report extending the BaseReportAction, let's say</p> <blockquote> <p>ExcelReportAction, PdfReportAction, etc...</p> </blockquote> <p>or </p> <blockquote> <p>MinimalReportAction, CompleteReportAction, etc...</p> </blockquote> <p>or also </p> <blockquote> <p>DailyReportAction, MonthlyReportAction, etc...</p> </blockquote> <p>And the only requirement would be using <code>super.execute();</code> as first statement of every child Action's <code>execute()</code> method.</p> <p>This way you could take advantage of the inheritance, to have a lot of smaller, cleaner (eventually packaged into several sub-packages) Actions instead of one huge Action with a lots of methods.</p> <p>All the utility methods used by few reports would be available only for those reports, not for all the others (let's say PDF and XLS stuff for example)...</p> <p>You could benefit of the XML Validation too for different Actions (maybe one report requires different inputs from another).</p> <p>Finally, your tuning-up code would be Thread-Safe (Actions are Thread-Safe, Interceptors don't).</p> <p>But as said, this is a choice of implementation that better suits the pre-code phase (even if it's not that hard to refactor, according to the size of the web application...).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload