[Struts] Reusing actions...

S

ShadowMan

Hi all
I'm trying to resolve the following problem.
I have more than one DispatchAction ...each of them can perform a "search +
result" action...
I would like to reuse the "search+result" component, that is
- a search criteria page
- a search result page
- a search action
but I would "hide" the search action wich is called only through the
DispatchAction with particular "parameter"...
how can I do it?!
 
O

Oscar kind

ShadowMan said:
I'm trying to resolve the following problem.
I have more than one DispatchAction ...each of them can perform a "search +
result" action...
I would like to reuse the "search+result" component, that is
- a search criteria page
- a search result page
- a search action
but I would "hide" the search action wich is called only through the
DispatchAction with particular "parameter"...
how can I do it?!

By using the command pattern, as Struts does: a search class defines a
generic search, and is subclassed for specific searches.

My action list for such a search+result component would be:
- Create a page that displays generic search criteria, provided by the
class mentioned below.
- Create a page that contains generic search results, given a list of
column names provided by the class mentioned below.
- Create an abstract superclass that does generic search, and subclasses
for each specific search. This is your "parameter".
- Create an Action / define a DispatchAction that calls the superclass,
using the specific instance defined by the parameter you mentioned.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top