You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/08/05 20:40:02 UTC
Nightly build 08052002: Tiles plugin and mapping.findForward
Subject: Nightly build 08052002: Tiles plugin and mapping.findForward
From: "Matt Raible" <ma...@raibledesigns.com>
===
I'd like to write a helper method to check for a <forward> and if none is
found, then to route to forward.
What is the best way to do this?
I know that mapping.findForward() will return a zero length array if nothing
is found, so what would I do next? I'd love it if there was a
mapping.findDefinition or something.
Thanks,
Matt
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Nightly build 08052002: Tiles plugin and mapping.findForward
Posted by Cedric Dumoulin <ce...@apache.org>.
Hello,
Your definition 'login' has an error:
<definition name="login" path="base">
I think you would like to extends 'base', not to use it as a path ;-).
If you specify a path, you should start it with a leading '/'.
Hope this help,
Cedric
matt_raible wrote:
>I just switched from using the ActionComponentServlet to the Tiles
>Plugin, but I still get the same error.
>
>Thanks,
>
>Matt
>
>--- In struts@y..., "matt_raible" <ma...@y...> wrote:
>
>
>>Basically, what I'm trying to do is use a DefaultAction to
>>
>>
>dispatch
>
>
>>requests through an action to my definitions. I'm experiencing
>>
>>
>some
>
>
>>wierd behavior. I have a Struts build from a couple nights ago.
>>
>>When I request http://localhost/myApp/index.do, everything works
>>fine - here's my log:
>>
>>- Processing a 'GET' for path '/index'
>>Requested URI: '/roller/index.do'
>>Forwarding to: 'index'
>>processActionForward(index, false)
>> 'index' - processed as definition
>>
>>But, when I request http://localhost/myApp/login.do, I get the
>>following log and subsequent error:
>>
>>LOG ---
>>- Processing a 'GET' for path '/login'
>>Requested URI: '/roller/login.do'
>>Forwarding to: 'login'
>>processActionForward(login, false)
>>
>>ERROR ---
>>ava.lang.IllegalArgumentException: Path base does not start with
>>a "/" character
>> at
>>org.apache.catalina.core.ApplicationContext.getRequestDispatcher
>>(ApplicationContext.java:572)
>> at
>>
>>
>>
>org.apache.catalina.core.ApplicationContextFacade.getRequestDispatche
>
>
>>r(ApplicationContextFacade.java:174)
>> at org.apache.struts.action.RequestProcessor.doForward
>>(RequestProcessor.java:1007)
>> at
>>
>>
>>
>org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition
>
>
>>(TilesRequestProcessor.java:237)
>> at
>>org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig
>>(TilesRequestProcessor.java:291)
>> at
>>org.apache.struts.action.RequestProcessor.processActionForward
>>(RequestProcessor.java:390)
>>
>>1. In struts-config.xml, I have:
>>
>><action path="/unknown"
>>
>>
>type="org.roller.presentation.DefaultAction"
>
>
>>unknown="true"/>
>>
>>2. In order to request a definition by using definitionName.do, I
>>have my DefaultAction coded as:
>>
>><snip>
>>String requestURI = request.getRequestURI();
>>String contextPath = request.getContextPath();
>>
>>String definitionName = requestURI.substring(contextPath.length());
>>definitionName = definitionName.substring(1, definitionName.indexOf
>>(".do"));
>>
>>return new ActionForward(definitionName);
>></snip>
>>
>>3. In my tiles configuration file (tiles-config.xml), I have:
>>
>> <!-- Base Layout Definition, most pages will extend -->
>> <definition name="base" path="/theme/layout.jsp">
>> <put name="title.prefix" value="title.prefix"/>
>> <put name="title.key"/>
>> <put name="footer" value="/theme/footer.jsp"/>
>> </definition>
>>
>> <!-- Index page -->
>> <definition name="index" extends="base">
>> <put name="title.key" value="title.index"/>
>> <put name="content" value="/index.jsp"/>
>> </definition>
>>
>> <!-- Login page -->
>> <definition name="login" path="base">
>> <put name="title.key" value="title.login"/>
>> <put name="content" value="/login.jsp"/>
>> </definition>
>>
>>Any ideas or suggestions are appreciated.
>>
>>Matt
>>
>>--- In struts@y..., Cedric Dumoulin <ce...@a...> wrote:
>>
>>
>>> Hi,
>>>
>>> You can test for a definition by asking the definition factory:
>>>
>>> DefinitionUtil.getDefinition( defName, servletRequest,
>>>
>>>
>>servletContext ) ;
>>
>>
>>>This return a ComponentDefinition, or throw
>>>
>>>
>>NoSuchDefinitionException if
>>
>>
>>>not found.
>>>
>>> Hope this help,
>>> Cedric
>>>
>>>Struts Newsgroup (@Basebeans.com) wrote:
>>>
>>>
>>>
>>>>Subject: Nightly build 08052002: Tiles plugin and
>>>>
>>>>
>>mapping.findForward
>>
>>
>>>>From: "Matt Raible" <ma...@r...>
>>>>===
>>>>I'd like to write a helper method to check for a <forward> and
>>>>
>>>>
>if
>
>
>>none is
>>
>>
>>>>found, then to route to forward.
>>>>
>>>>What is the best way to do this?
>>>>
>>>>I know that mapping.findForward() will return a zero length
>>>>
>>>>
>array
>
>
>>if nothing
>>
>>
>>>>is found, so what would I do next? I'd love it if there was a
>>>>mapping.findDefinition or something.
>>>>
>>>>Thanks,
>>>>
>>>>Matt
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail: <ma...@j...>
>>>>For additional commands, e-mail: <ma...@j...>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>--
>>>To unsubscribe, e-mail: <ma...@j...>
>>>For additional commands, e-mail: <ma...@j...>
>>>
>>>
>>--
>>To unsubscribe, e-mail: <ma...@j...>
>>For additional commands, e-mail: <ma...@j...>
>>
>>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Nightly build 08052002: Tiles plugin and mapping.findForward
Posted by matt_raible <ma...@yahoo.com>.
I just switched from using the ActionComponentServlet to the Tiles
Plugin, but I still get the same error.
Thanks,
Matt
--- In struts@y..., "matt_raible" <ma...@y...> wrote:
> Basically, what I'm trying to do is use a DefaultAction to
dispatch
> requests through an action to my definitions. I'm experiencing
some
> wierd behavior. I have a Struts build from a couple nights ago.
>
> When I request http://localhost/myApp/index.do, everything works
> fine - here's my log:
>
> - Processing a 'GET' for path '/index'
> Requested URI: '/roller/index.do'
> Forwarding to: 'index'
> processActionForward(index, false)
> 'index' - processed as definition
>
> But, when I request http://localhost/myApp/login.do, I get the
> following log and subsequent error:
>
> LOG ---
> - Processing a 'GET' for path '/login'
> Requested URI: '/roller/login.do'
> Forwarding to: 'login'
> processActionForward(login, false)
>
> ERROR ---
> ava.lang.IllegalArgumentException: Path base does not start with
> a "/" character
> at
> org.apache.catalina.core.ApplicationContext.getRequestDispatcher
> (ApplicationContext.java:572)
> at
>
org.apache.catalina.core.ApplicationContextFacade.getRequestDispatche
> r(ApplicationContextFacade.java:174)
> at org.apache.struts.action.RequestProcessor.doForward
> (RequestProcessor.java:1007)
> at
>
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition
> (TilesRequestProcessor.java:237)
> at
> org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig
> (TilesRequestProcessor.java:291)
> at
> org.apache.struts.action.RequestProcessor.processActionForward
> (RequestProcessor.java:390)
>
> 1. In struts-config.xml, I have:
>
> <action path="/unknown"
type="org.roller.presentation.DefaultAction"
> unknown="true"/>
>
> 2. In order to request a definition by using definitionName.do, I
> have my DefaultAction coded as:
>
> <snip>
> String requestURI = request.getRequestURI();
> String contextPath = request.getContextPath();
>
> String definitionName = requestURI.substring(contextPath.length());
> definitionName = definitionName.substring(1, definitionName.indexOf
> (".do"));
>
> return new ActionForward(definitionName);
> </snip>
>
> 3. In my tiles configuration file (tiles-config.xml), I have:
>
> <!-- Base Layout Definition, most pages will extend -->
> <definition name="base" path="/theme/layout.jsp">
> <put name="title.prefix" value="title.prefix"/>
> <put name="title.key"/>
> <put name="footer" value="/theme/footer.jsp"/>
> </definition>
>
> <!-- Index page -->
> <definition name="index" extends="base">
> <put name="title.key" value="title.index"/>
> <put name="content" value="/index.jsp"/>
> </definition>
>
> <!-- Login page -->
> <definition name="login" path="base">
> <put name="title.key" value="title.login"/>
> <put name="content" value="/login.jsp"/>
> </definition>
>
> Any ideas or suggestions are appreciated.
>
> Matt
>
> --- In struts@y..., Cedric Dumoulin <ce...@a...> wrote:
> >
> > Hi,
> >
> > You can test for a definition by asking the definition factory:
> >
> > DefinitionUtil.getDefinition( defName, servletRequest,
> servletContext ) ;
> > This return a ComponentDefinition, or throw
> NoSuchDefinitionException if
> > not found.
> >
> > Hope this help,
> > Cedric
> >
> > Struts Newsgroup (@Basebeans.com) wrote:
> >
> > >Subject: Nightly build 08052002: Tiles plugin and
> mapping.findForward
> > >From: "Matt Raible" <ma...@r...>
> > > ===
> > >I'd like to write a helper method to check for a <forward> and
if
> none is
> > >found, then to route to forward.
> > >
> > >What is the best way to do this?
> > >
> > >I know that mapping.findForward() will return a zero length
array
> if nothing
> > >is found, so what would I do next? I'd love it if there was a
> > >mapping.findDefinition or something.
> > >
> > >Thanks,
> > >
> > >Matt
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail: <ma...@j...>
> > >For additional commands, e-mail: <ma...@j...>
> > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: <ma...@j...>
> > For additional commands, e-mail: <ma...@j...>
>
>
> --
> To unsubscribe, e-mail: <ma...@j...>
> For additional commands, e-mail: <ma...@j...>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Nightly build 08052002: Tiles plugin and mapping.findForward
Posted by matt_raible <ma...@yahoo.com>.
Basically, what I'm trying to do is use a DefaultAction to dispatch
requests through an action to my definitions. I'm experiencing some
wierd behavior. I have a Struts build from a couple nights ago.
When I request http://localhost/myApp/index.do, everything works
fine - here's my log:
- Processing a 'GET' for path '/index'
Requested URI: '/roller/index.do'
Forwarding to: 'index'
processActionForward(index, false)
'index' - processed as definition
But, when I request http://localhost/myApp/login.do, I get the
following log and subsequent error:
LOG ---
- Processing a 'GET' for path '/login'
Requested URI: '/roller/login.do'
Forwarding to: 'login'
processActionForward(login, false)
ERROR ---
ava.lang.IllegalArgumentException: Path base does not start with
a "/" character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher
(ApplicationContext.java:572)
at
org.apache.catalina.core.ApplicationContextFacade.getRequestDispatche
r(ApplicationContextFacade.java:174)
at org.apache.struts.action.RequestProcessor.doForward
(RequestProcessor.java:1007)
at
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition
(TilesRequestProcessor.java:237)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig
(TilesRequestProcessor.java:291)
at
org.apache.struts.action.RequestProcessor.processActionForward
(RequestProcessor.java:390)
1. In struts-config.xml, I have:
<action path="/unknown" type="org.roller.presentation.DefaultAction"
unknown="true"/>
2. In order to request a definition by using definitionName.do, I
have my DefaultAction coded as:
<snip>
String requestURI = request.getRequestURI();
String contextPath = request.getContextPath();
String definitionName = requestURI.substring(contextPath.length());
definitionName = definitionName.substring(1, definitionName.indexOf
(".do"));
return new ActionForward(definitionName);
</snip>
3. In my tiles configuration file (tiles-config.xml), I have:
<!-- Base Layout Definition, most pages will extend -->
<definition name="base" path="/theme/layout.jsp">
<put name="title.prefix" value="title.prefix"/>
<put name="title.key"/>
<put name="footer" value="/theme/footer.jsp"/>
</definition>
<!-- Index page -->
<definition name="index" extends="base">
<put name="title.key" value="title.index"/>
<put name="content" value="/index.jsp"/>
</definition>
<!-- Login page -->
<definition name="login" path="base">
<put name="title.key" value="title.login"/>
<put name="content" value="/login.jsp"/>
</definition>
Any ideas or suggestions are appreciated.
Matt
--- In struts@y..., Cedric Dumoulin <ce...@a...> wrote:
>
> Hi,
>
> You can test for a definition by asking the definition factory:
>
> DefinitionUtil.getDefinition( defName, servletRequest,
servletContext ) ;
> This return a ComponentDefinition, or throw
NoSuchDefinitionException if
> not found.
>
> Hope this help,
> Cedric
>
> Struts Newsgroup (@Basebeans.com) wrote:
>
> >Subject: Nightly build 08052002: Tiles plugin and
mapping.findForward
> >From: "Matt Raible" <ma...@r...>
> > ===
> >I'd like to write a helper method to check for a <forward> and if
none is
> >found, then to route to forward.
> >
> >What is the best way to do this?
> >
> >I know that mapping.findForward() will return a zero length array
if nothing
> >is found, so what would I do next? I'd love it if there was a
> >mapping.findDefinition or something.
> >
> >Thanks,
> >
> >Matt
> >
> >
> >
> >--
> >To unsubscribe, e-mail: <ma...@j...>
> >For additional commands, e-mail: <ma...@j...>
> >
> >
> >
> >
>
>
>
> --
> To unsubscribe, e-mail: <ma...@j...>
> For additional commands, e-mail: <ma...@j...>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Nightly build 08052002: Tiles plugin and mapping.findForward
Posted by Cedric Dumoulin <ce...@apache.org>.
Hi,
You can test for a definition by asking the definition factory:
DefinitionUtil.getDefinition( defName, servletRequest, servletContext ) ;
This return a ComponentDefinition, or throw NoSuchDefinitionException if
not found.
Hope this help,
Cedric
Struts Newsgroup (@Basebeans.com) wrote:
>Subject: Nightly build 08052002: Tiles plugin and mapping.findForward
>From: "Matt Raible" <ma...@raibledesigns.com>
> ===
>I'd like to write a helper method to check for a <forward> and if none is
>found, then to route to forward.
>
>What is the best way to do this?
>
>I know that mapping.findForward() will return a zero length array if nothing
>is found, so what would I do next? I'd love it if there was a
>mapping.findDefinition or something.
>
>Thanks,
>
>Matt
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>