You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2005/11/02 16:49:13 UTC

Re: can JSF navigration(redirect) carry any parameters?

I think once you specify the <redirect/> navigation rule, you actually
cause two requests to execute.   The first one is a normal http post
that evaluates your command.   The next one is a real redirect and
there aren't any request parameters preserved across that redirect, so
you can't use t:saveState or f:param to preserve the values.   I
suspect the only option open is to store the data in your Session
temporarily, or to specify a non-JSF URL for the redirect and append
parameters on it ...?p1=arg1&p2=arg2....

This is my understanding based on other people's comments -- I haven't
really worked with it myself.

On 10/30/05, Nikita Koselev <ko...@gmail.com> wrote:
> I'd the same problem lately. It seems that parameter <f:param> tag
> doesn't help in this situation... I mean I use <f:param> tag in wrong
> way.
>
> Nikita
>
> On 30/10/05, Dave <ja...@yahoo.com> wrote:
> > When a user click a command link to a protected page, a <redirect> is needed
> > for navigation. I need to specify some parameters for the page. Is there a
> > way?
> >
> > Thanks, Dave
> >
> >  ________________________________
> >  Yahoo! FareChase - Search multiple travel sites in one click.
> >
> >
>

Re: can JSF navigration(redirect) carry any parameters?

Posted by Simon Kitching <sk...@obsidium.com>.
Dave wrote:
> The parameters are dynamic and determined at runtime.  It would be nice 
> if the navigationHandler take parameters specified in the action 
> result somehow like:
>              actionResult?p1=arg1&p2=arg2....
> Then the parameters will be included in the redirect URL.
>  
> It is very useful. One use case:
>  
> When an authenticated user click "Send Email" link, but "Send Email" is 
> a protected page. <redirect/> is required to go through login  process. 
> Here I hope the redirect URL to carry the receiver name, and subject. 
> When "send email" page comes up, it will have been filled with receiver 
> and subject.

It feels to me like you're fighting the system.

JSF is not Struts, which is "url-oriented". JSF is a *component* 
framework that is more like Swing than like Struts in many ways. So 
state should not be carried around as "url parameters" but instead by 
setting state on the appropriate JSF components or model objects.

By "click send email", do you mean that the user is selecting something 
in a JSF page? If so, the Email page should be getting the send-to-email 
and subject values from some model object, so the fact that you redirect 
to a login page in the middle isn't an issue.

Or do you mean that the link is somewhere on a web page that is *not* 
part of the same webapp? In this case, it seems to me the problem is due 
to trying to leap into a webapp from outside the webapp, ie is an issue 
with integrating standard HTML with JSF not a problem with JSF itself. 
In this case I would suggest having a special servlet (not a JSF 
component) that looks into the request parameters, updates some MODEL 
object in the session then redirects to the JSF page. When the JSF page 
runs, it will then see your model has the send-to and subject set, and 
will render them. Note; I've not done any of this myself, I'm just 
speculating here.

Regards,

Simon

Re: can JSF navigration(redirect) carry any parameters?

Posted by Dave <ja...@yahoo.com>.
The parameters are dynamic and determined at runtime.  It would be nice if the navigationHandler take parameters specified in the action result somehow like:
             actionResult?p1=arg1&p2=arg2....
Then the parameters will be included in the redirect URL.
 
It is very useful. One use case:
 
When an authenticated user click "Send Email" link, but "Send Email" is a protected page. <redirect/> is required to go through login  process. Here I hope the redirect URL to carry the receiver name, and subject. When "send email" page comes up, it will have been filled with receiver and subject.
 


Mike Kienenberger <mk...@gmail.com> wrote:
I think once you specify the navigation rule, you actually
cause two requests to execute. The first one is a normal http post
that evaluates your command. The next one is a real redirect and
there aren't any request parameters preserved across that redirect, so
you can't use t:saveState or f:param to preserve the values. I
suspect the only option open is to store the data in your Session
temporarily, or to specify a non-JSF URL for the redirect and append
parameters on it ...?p1=arg1&p2=arg2....

This is my understanding based on other people's comments -- I haven't
really worked with it myself.

On 10/30/05, Nikita Koselev wrote:
> I'd the same problem lately. It seems that parameter tag
> doesn't help in this situation... I mean I use tag in wrong
> way.
>
> Nikita
>
> On 30/10/05, Dave wrote:
> > When a user click a command link to a protected page, a is needed
> > for navigation. I need to specify some parameters for the page. Is there a
> > way?
> >
> > Thanks, Dave
> >
> > ________________________________
> > Yahoo! FareChase - Search multiple travel sites in one click.
> >
> >
>

		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.