You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Randahl Fink Isaksen <ra...@rockit.dk> on 2006/11/09 16:55:49 UTC

URL rewriting and view separation

I have a system which relies heavily on URL rewriting. The same JSF page 
is used to serve different pages, for instance

request "/Products/Product 1" is forwarded to 
"/productView.jsf?name=Product 1" and
request "/Products/Product 2" is forwarded to 
"/productView.jsf?name=Product 2"

I have been wondering what consequences this has for MyFaces. I know 
that according to JSF MyFaces is allowed to cache the views in session 
scope and reuse them, but since I forward all requests to the same view, 
I would like to know if MyFaces is able to tell the difference. Are both 
of the above requests seen by MyFaces as the same view, or two different 
views after the forwarding?

Randahl



Re: URL rewriting and view separation

Posted by Randahl Fink Isaksen <ra...@rockit.dk>.
Is it possible to enforce a certain view ID, so that the originally 
different requests are cached as different views even though the views 
are constructed by the same view handler file? The reason I am asking is 
I am using facelets and the two views mentioned are radically different, 
so it might be more efficient caching them individually.

Randahl


Andrew Robinson wrote:
> View = ViewID by default (parameters are not part of the viewID). So
> if you do the forwarding, you will have the same view. The only
> difference will be your request parameters (name parameter) which you
> can access from the view or backing beans.
>
> On 11/9/06, Randahl Fink Isaksen <ra...@rockit.dk> wrote:
>> I have a system which relies heavily on URL rewriting. The same JSF page
>> is used to serve different pages, for instance
>>
>> request "/Products/Product 1" is forwarded to
>> "/productView.jsf?name=Product 1" and
>> request "/Products/Product 2" is forwarded to
>> "/productView.jsf?name=Product 2"
>>
>> I have been wondering what consequences this has for MyFaces. I know
>> that according to JSF MyFaces is allowed to cache the views in session
>> scope and reuse them, but since I forward all requests to the same view,
>> I would like to know if MyFaces is able to tell the difference. Are both
>> of the above requests seen by MyFaces as the same view, or two different
>> views after the forwarding?
>>
>> Randahl
>>
>>
>>
>
>


Re: URL rewriting and view separation

Posted by Andrew Robinson <an...@gmail.com>.
View = ViewID by default (parameters are not part of the viewID). So
if you do the forwarding, you will have the same view. The only
difference will be your request parameters (name parameter) which you
can access from the view or backing beans.

On 11/9/06, Randahl Fink Isaksen <ra...@rockit.dk> wrote:
> I have a system which relies heavily on URL rewriting. The same JSF page
> is used to serve different pages, for instance
>
> request "/Products/Product 1" is forwarded to
> "/productView.jsf?name=Product 1" and
> request "/Products/Product 2" is forwarded to
> "/productView.jsf?name=Product 2"
>
> I have been wondering what consequences this has for MyFaces. I know
> that according to JSF MyFaces is allowed to cache the views in session
> scope and reuse them, but since I forward all requests to the same view,
> I would like to know if MyFaces is able to tell the difference. Are both
> of the above requests seen by MyFaces as the same view, or two different
> views after the forwarding?
>
> Randahl
>
>
>