struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Dumoulin <ced...@apache.org>
Subject Re: Nightly build 08052002: Tiles plugin and mapping.findForward
Date Wed, 14 Aug 2002 20:24:52 GMT

  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" <matt_raible@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 <cedric@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" <matt@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:   <mailto:struts-user-unsubscribe@j...>
>>>>For additional commands, e-mail: <mailto:struts-user-help@j...>
>>>>
>>>>
>>>> 
>>>>
>>>>        
>>>>
>>>
>>>--
>>>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@j...>
>>>For additional commands, e-mail: <mailto:struts-user-help@j...>
>>>      
>>>
>>--
>>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@j...>
>>For additional commands, e-mail: <mailto:struts-user-help@j...>
>>    
>>
>
>
>--
>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>
>
>  
>



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


Mime
View raw message