First, thanks again for the patience of the group on this matter and for
those who helped; Rick, Wendy, and Volker.
I definitely had a "Struts" mindset when it came to the request
processing life cycle. Once I read through the spec. and understood the
request processing life cycle a little better, things became more clear
as to the behavior I was seeing.
Here's what I ended up doing:
- Used path mapping in web.xml and mapped the JSF servlet to /app/*
- Defined index.jsp as a welcome page for my app.
- Used a <jsp:forward page="/app/launch.jsp"/> in index.jsp.
(Note I do not have a page launch.jsp under my web app root context).
This is kind of tricky here. Since I'm using JspTilesViewHandlerImpl, it
processes the request like so:
- Determines that I'm using path mapping and not extension mapping
- Looks for the default suffix (.jsp)
- Replaces the default suffix with the default Tiles suffix (.tiles).
- Looks up the Tiles definition corresponding to /launch.tiles
- Dispatches to /lauch.tiles
From there, Tiles does the rest as far as rendering the view. It ended
up pulling my /pages/launch.jsp into a template as defined by the tile.
As a couple of you already mentioned, the navigation rules did not even
come into play. This is because, it was a non-faces request; meaning the
request did not originate as a result of a JSF request.
I also learned that the extension which the JspTilesViewHandlerImpl
looks for to determine if it should be processed by Tiles, is
configurable. You can define something other than the default by placing
it in the web.xml init context param under the attribute,
javax.faces.DEFAULT_SUFFIX. For example:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.myTilesSuffix</param-value>
</context-param>
Anyhow, I think I'm good to go for now. I'll press on with more
adventures in JSF :)
/robert
Robert Taylor wrote:
Yep. Good advice. I'm backing out the JspTilesViewHandlerImpl for now
and am using the default. I'll get it eventually.
/robert
Rick Reumann wrote:
Robert, I haven't figured out Tiles yet with JSF. I got frustrated
trying too many things at once, so I backed out my Tiles stuff and
just tried to get a simple app working first. My next step is to learn
tiles. I have the feeling using Tiles might really complicate the
learning process.
On 9/17/05, *Robert Taylor* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Wow! I feel like I'm in left field here.
Let me back up and tell you what I want to accomplish.
I have an existing Struts application which I want to convert to
using
JSF. That application uses tiles and prefix mapping. I have the
Struts
application set up such that when the user invokes /app/launch, the
Struts controller is invoked (prefix mapping for Struts servlet is
/app/*), looks up the corresponding action mapping,
TilesRequestProcessor resolves the tiles definition then builds my
page.
So far, the examples I have provided on this thread use extesion
mapping. This is because I started having so much trouble with prefix
mapping, that I thought if I could get my example working using
extension mapping, I could simply change the mapping and I would be
okay.
So before I waste more bandwidth, I'm going to do some more research,
because I obviously don't understand the life cycle.
Thanks for all who have helped so far.
/robert
Volker Weber wrote:
> Hi,
>
> as i mentioned before: your has to made the redirect/forward link
relative.
>
> I just check this out with the redirect in my application.
Prefixing the
> redirect url with a '/' results in a
> "HTTP Status 404 - /faces/overview/intro.jsp" !
>
> If you use absolute url you has to add the application path also.
>
> If you know the url you has to type in your browser to get your
launch
> page, this is exactly the url to must redirect/forward to!
>
> The navigation-rules of your faces-config.xml are not needed for
this,
> just for inner application navigation.
>
> Regards
>
> Rick Reumann wrote:
>
>>Well I believe your index page of:
>>
>><jsp:forward page="/launch.faces"/>
>>
>>Is going to try to find /launch.jsp in the root but you don't have
>>launch there so make it:
>>
>><jsp:forward page="/pages/launch.faces"/> and you should be all
set.
>>
>>Also this rule:
>>
>><navigation-rule>
>> <navigation-case>
>> <to-view-id>/pages/launch.jsp</to-view-id>
>> </navigation-case>
>></navigation-rule>
>>
>>
>>I don't think will do anything since you don't have a from-outcome
>>defined, so I'm not sure what the above will ever do. I think
you are
>>expecting the to-view-id to fire based on the forward set up in
your
>>index, but that's not the case since that forward is going to
try to
>>resolve to a jsp (which doesn't exist in your root).
>
>
--
Rick