A snippet I use for an action that takes a parameter and forwards to a tiles
definition.  My action also forwards to a page, forward, or mapping
parameter but this is only the tiles section.  I copied out of the tiles
request processor.  Also this is 1.1 b3 code.

    
      wantForward = request.getParameter("forward");

      ComponentDefinition definition = null;

        try
        {
            DefinitionsFactory tilesDef =
TilesUtil.getDefinitionsFactory(request,
 
getServlet().getServletContext());

            definition = tilesDef.getDefinition( wantForward,
                                                 request,
 
getServlet().getServletContext() );
        }  catch ( FactoryNotFoundException ex )
        {
          cat.error("Error - DefinitionDispatcherAction : Can't get
definition factory.");

        }  catch ( NoSuchDefinitionException ex )
        {
          cat.error("Error - DefinitionDispatcherAction : Can't get
definition '"
                     + wantForward + "'.");

        }  catch ( DefinitionsFactoryException ex )
        {
        cat.error("Error - DefinitionDispatcherAction : General Factory
error '"
                    + ex.getMessage() + "'.");

        }  catch ( Exception ex )
        {
        cat.error("Error - DefinitionDispatcherAction : General error '"
                    + ex.getMessage() + "'.");
        }

   

Cal 

http://www.calandva.com/            Last update 01/03/03


-----Original Message-----
From: Duane Morin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 16:14
To: [EMAIL PROTECTED]
Subject: [Tiles] Linking to definitions factory from servlet

I've got Tiles configured as a struts plug-in:

<plug-in className="org.apache.struts.tiles.TilesPlugin">
 <set-property property="definitions-config"
                value="/WEB-INF/tiles-defs.xml"/>
 <set-property property="moduleAware" value="true" />
 <set-property property="definitions-parser-validate" value="true" />
 <set-property property="definitions-debug" value="1" />
</plug-in>

I've got a servlet that takes the name of a tiles definition as a
parameter.  Before forwarding it along to my dispatcher page, I'd like to
look it up in the factory and make sure it exists (and forward to a
different page if necessary).  How can I get a link to the definitions
factory?  Do I need to instantiate tiles in some other way?  It is safe to
create a second instead of the factory for my own use?

Duane



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
Learn more about Paymentech's payment processing services at www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary 
and confidential information intended only for the use of the recipient(s) named 
above.  If you are not the intended recipient, you may not print, distribute, or copy 
this message or any attachments.  If you have received this communication in error, 
please notify the sender by return e-mail and delete this message and any attachments 
from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to