It's not as easy as modifying the code the way I did, because if you use
the validation in a form, and the validation fails, it goes through the
tiles processor with and uri null, and because of the modifications it
fails coming back to the original screen.

So I've put the old code(in fact the normal code) and change the
include/forward code from:
...
           if (doInclude) {
               log.info("Tiles process complete; doInclude with " +
uri);
               doInclude(sacontext, uri);
           } else {
               log.info("Tiles process complete; forward to " + uri);
               doForward(sacontext, uri);
           }
...
To
...
        uri = uri.trim();
        if (uri.length()>0)
        {
           if (doInclude) {
               log.info("Tiles process complete; doInclude with " +
uri);
               doInclude(sacontext, uri);
           } else {
               log.info("Tiles process complete; forward to " + uri);
               doForward(sacontext, uri);
           }
        }
...

And put path = "" in the tiles-def.xml. Again I don't know the
implications, but at this moment it works for me.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Benedict
Sent: Wednesday, August 22, 2007 02:43 AM
To: Struts Users Mailing List
Subject: Re: Tiles: definition without path

Please see:
https://issues.apache.org/struts/browse/STR-1981

Paul

On 8/21/07, Jose Luis Martinez Avial <[EMAIL PROTECTED]>
wrote:
>
> I've tried to modify the execute method of TilesPreProcessor from
>
> ...
>         if(uri == null)
>         {
>             log.debug("no uri computed, so pass to next command");
>             return false;
>         }
>         if(controller != null)
>         {
>             log.trace("Execute controller: " + controller);
>             controller.execute(tileContext, sacontext.getRequest(),
> sacontext.getResponse(), sacontext.getContext());
>         }
> ...
>
> To
> ...
>         if (controller != null) {
>             log.trace("Execute controller: " + controller);
>
>
controller.execute(tileContext,sacontext.getRequest(),sacontext.getRespo
> nse(),sacontext.getContext());
>         }
>         if (uri == null) {
>             log.debug("no uri computed, so pass to next command");
>             sacontext.setForwardConfig( null );
>             return false;
>         }
> ...
>
> So it execute the controller even if the uri is null, and after that
if
> the uri is null, it will put the ForwardConfig to null and return,
> because is the end of the processing. It works for me, but I don't
know
> all the implications of this change.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Paul Benedict
> Sent: Tuesday, August 21, 2007 18:32 PM
> To: Struts Users Mailing List
> Subject: Re: Tiles: definition without path
>
> I'll have to investigate this.
>
> On 8/21/07, Jose Luis Martinez Avial
<[EMAIL PROTECTED]>
> wrote:
> >
> > The question is that I don't need to forward to a JSP. The
controller
> > takes the HttpServletResponse and writes in it, and that is the
> response
> > to the user. Before that I put the image as an attribute in the
> request,
> > and in a JSP template I recovered it form the request, and wrote it,
> but
> > the tomcat always said that the Output stream had already been
closed.
> >
> > Is there anyway to return a image to the user using a controller
> without
> > using a JSP?
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> > On Behalf Of Paul Benedict
> > Sent: Tuesday, August 21, 2007 18:18 PM
> > To: Struts Users Mailing List
> > Subject: Re: Tiles: definition without path
> >
> > I don't understand why you haven't provided a path attribute on the
> > definition. Definitions need to resolve to a resource. I don't see a
> JSP
> > listed.
> >
> > On 8/21/07, Jose Luis Martinez Avial
> <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > I'm using Struts 1.3.9, with Tiles. I've one action that calls to
a
> > > definition
> > > struts-config.xml
> > >        <action path="/customer/verGraphPortfolio"
> > > forward="verGraphPortfolio.pantalla"/>
> > >
> > > riles-def..xml
> > >        <definition name=" verGraphPortfolio.pantalla"
> > >
> >
>
controllerClass="com.bpi.isis.customer.web.vista.PortfolioValGraphContro
> > > ller"/>
> > >
> > >        In the PortfolioValGraphController I have this code
> > >
> > >                 ....
> > >                 response.setHeader("Content-Disposition",
"inline");
> > >                 response.setHeader("Cache-Control", "no-cache");
> > >                 response.setHeader("Cache-Control", "no-store");
> > >                 response.setHeader("Cache-Control",
> > "must-revalidate");
> > >
> response.getOutputStream().write(baos.toByteArray());
> > >                 response.getOutputStream().flush();
> > >                 response.getOutputStream().close();
> > >                 response.setStatus(HttpServletResponse.SC_OK);
> > >                 baos.close();
> > >                 baos = null;
> > >                 .....
> > >
> > > If I don't put the path attribute in the definition, the
controller
> is
> > > not invocated and the user doesn't see the image. In the logs your
> can
> > > see this:
> > >
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.tiles.ComponentDefinition  - Controller created
:
> > > [EMAIL PROTECTED]
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.tiles.commands.TilesPreProcessor  - no uri
> computed,
> > > so pass to next command
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.chain.commands.ActionCommandBase  - Executing
> > > org.apache.struts.chain.commands.servlet.PerformForward
> > > 21 Aug 2007 13:11:36,711  DEBUG
org.apache.struts.util.RequestUtils
> -
> > > No actionId found for verGraphPortfolio.pantalla
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.chain.commands.ExceptionCatcher  - Attempting to
> > > handle a thrown exception
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.chain.commands.ExceptionCatcher  - Calling
> > > exceptionCommand 'servlet-exception'
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.chain.commands.ActionCommandBase  - Executing
> > > org.apache.struts.chain.commands.servlet.ExceptionHandler
> > > 21 Aug 2007 13:11:36,711  DEBUG
> > > org.apache.struts.chain.commands.AbstractExceptionHandler  - See
if
> > > actionConfig
> > >
> >
>
ActionConfig[cancellable=false,path=/customer/verGraphPortfolio,validate
> > > =true,forward=verGraphPortfolio.pantalla,scope=session has an
> > > exceptionConfig for java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for
java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.RuntimeException
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.RuntimeException
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Exception
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Exception
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Throwable
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Throwable
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Object
> > > 21 Aug 2007 13:11:36,711  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Object
> > > 21 Aug 2007 13:11:36,711  WARN
> > > org.apache.struts.chain.commands.AbstractExceptionHandler  -
> Unhandled
> > > exception
> > > java.lang.IllegalArgumentException: Path
verGraphPortfolio.pantalla
> > does
> > > not start with a "/" character
> > >         at
> > >
> >
>
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(Applica
> > > tionContext.java:379)
> > >         at
> > >
> >
>
org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(A
> > > pplicationContextFacade.java:195)
> > >         at
> > >
> >
>
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(
> > > PerformForward.java:107)
> > >         at
> > >
> >
>
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformF
> > > orward.java:96)
> > >
> > >
> > >
> > >
> > > If I put path = "", then the controller is invocated, and the user
> see
> > > the image, but you see this logs
> > > 21 Aug 2007 13:11:28,320  INFO
> > > org.apache.struts.tiles.commands.TilesPreProcessor  - Tiles
process
> > > complete; forward to
> > > 21 Aug 2007 13:11:28,320  DEBUG
> > > org.apache.struts.chain.commands.ExceptionCatcher  - Attempting to
> > > handle a thrown exception
> > > 21 Aug 2007 13:11:28,320  DEBUG
> > > org.apache.struts.chain.commands.ExceptionCatcher  - Calling
> > > exceptionCommand 'servlet-exception'
> > > 21 Aug 2007 13:11:28,320  DEBUG
> > > org.apache.struts.chain.commands.ActionCommandBase  - Executing
> > > org.apache.struts.chain.commands.servlet.ExceptionHandler
> > > 21 Aug 2007 13:11:28,320  DEBUG
> > > org.apache.struts.chain.commands.AbstractExceptionHandler  - See
if
> > > actionConfig
> > >
> >
>
ActionConfig[cancellable=false,path=/divisas/verGraphExchRate,validate=t
> > > rue,forward=verGraphExchRate.pantalla,scope=session has an
> > > exceptionConfig for java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for
java.lang.IllegalArgumentException
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.RuntimeException
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.RuntimeException
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Exception
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Exception
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Throwable
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Throwable
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look locally for java.lang.Object
> > > 21 Aug 2007 13:11:28,320  DEBUG
> org.apache.struts.config.ActionConfig
> > -
> > > findException: look globally for java.lang.Object
> > > 21 Aug 2007 13:11:28,320  WARN
> > > org.apache.struts.chain.commands.AbstractExceptionHandler  -
> Unhandled
> > > exception
> > > java.lang.IllegalArgumentException: Path  does not start with a
"/"
> > > character
> > >         at
> > >
> >
>
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(Applica
> > > tionContext.java:379)
> > >         at
> > >
> >
>
org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(A
> > > pplicationContextFacade.java:195)
> > >         at
> > >
> >
>
org.apache.struts.tiles.commands.TilesPreProcessor.getRequiredDispatcher
> > > (TilesPreProcessor.java:274)
> > >         at
> > >
> >
>
org.apache.struts.tiles.commands.TilesPreProcessor.doForward(TilesPrePro
> > > cessor.java:257)
> > >         at
> > >
> >
>
org.apache.struts.tiles.commands.TilesPreProcessor.execute(TilesPreProce
> > > ssor.java:217)
> > >         at
> > >
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
> > >         at
> > >
> >
>
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.jav
> > > a:304)
> > >
> > > Do I need to put a JSP in the path? An empty JSP? Is there any way
> to
> > > avoid this?
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> Internet communications are not secure and therefore Banco
> Santander International does not accept legal responsibility for
> the contents of this message. Any views or opinions presented are
> solely those of the author and do not necessarily represent those
> of Banco Santander International unless otherwise specifically
> stated.
>
> Las comunicaciones via Internet no son seguras y por lo tanto
> Banco Santander International no asume responsabilidad legal ni
> de ningun otro tipo por el contenido de este mensaje. Cualquier
> opinion transmitida pertenece unicamente al autor y no
> necesariamente representa la opinion del Banco Santander
> International a no ser que este expresamente detallado.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Internet communications are not secure and therefore Banco
Santander International does not accept legal responsibility for
the contents of this message. Any views or opinions presented are
solely those of the author and do not necessarily represent those
of Banco Santander International unless otherwise specifically
stated.

Las comunicaciones via Internet no son seguras y por lo tanto
Banco Santander International no asume responsabilidad legal ni
de ningun otro tipo por el contenido de este mensaje. Cualquier
opinion transmitida pertenece unicamente al autor y no
necesariamente representa la opinion del Banco Santander
International a no ser que este expresamente detallado.



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

Reply via email to