You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Sayre <ri...@gmail.com> on 2008/05/01 15:45:42 UTC

Multiple Results or How should I handle this?

I have an Action that could display several pages based on some info
passed to it.

Basically, its a preview action that will show the proper preview page
based on some input.

The way I am think of doing it is to use custom results to redirect to
the proper preview page:

if (preview1) {

   return CUSTOM_RESULT_PREV1;

} else if(preview2) {

   return CUSTOM_RESULT_PREV2;

}

and so on.  But I'm not sure if this is the 'best' way.

The page that is calling this, could be accessed from different
modules in the application,  and the preview gives alot of information
about the specific module item that loaded this page.  Since this page
can be called by X number of modules, and that number of modules will
grow in the future, I am looking for a smooth way to handle the
'preview' button on that page.

To handle the saving of the data, I abstracted the BridgeDAO.

So if the shared module is called ModX then the save action looks like this:

The action gets passed the module that called ModX and the id of the
module item that called it

modxDao.save(modX);

bridgeDao = factory.getBridgeDao(ModuleId);

//so now we have a dao for assiating the modX record to the module
that created it

bridgeDao.associateModX(moduleItemId);

As you can tell, the MOdX data can be associated with other different
modules in my application.


So does any have any suggestion on how I should handle the 'preview'
portion of this?

The preview pages that are currently in the system, are all very
unique with regards to content and layout.  So I was thinking a bunch
of ifs with custom results as shown above would be a good way to go.
But I am also wondering if this should be abstracted, or would that be
over kill.

Any comments would be greatly appreciated,

Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org