> The key is that the prerender() method of the ViewController bean
> associated with your productlist.jsp page is called, just before
> rendering, no matter how you navigated to it (or where you came from).
>  This is the right place to do the database search that actually
> populates the product list table that is being generated.

Ok, that's a good thing about another issue - when having several target page 
options for one action.
But the problem I mentioned is having several source page (where the call comes 
from) options for one action. Every source page has
it's own form bean which validates the source form. But Struts accepts just one 
form bean per action (or with StrutsShale one form
bean per target form).
But you actually need one form bean per source form as well.
The way JSF does it - with the form bean associated with the form, not with the 
action - would be perfect.

I know, this is the wrong place to discuss Struts issues, but I still hope 
there is a way to solve this problem just with JSF.

Once again - is it possible to choose the navigation case through the URL 
instead of a parameter, to get a real connection (usually
1:1) between request URL and response output?
I would be surprised, if this use case is not very common and if JSF (or 
Struts) would not provide a solution for this.

Thanks,
Chily


P.S. @Craig: Is it possible/reasonable to use StrutsShale already, since there 
are no stable builds so far?



-----Original Message-----
From: Craig McClanahan [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 6:18 AM
To: MyFaces Discussion
Subject: Re: Strange navigation in MyFaces examples


On Mon, 14 Mar 2005 00:27:19 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> So e.g. you have an action, which shows a product list, called through URL 
> "/productlist.do".
> This URL/action can be called from a menu, from a book detail form (when 
> saving) and from a cd detail form (saving).
> So it doesn't make sense to associate this action with one specific form bean 
> since there are already two different beans used
with
> this call (and one call using no bean at all).
> Connecting the bean directly to the form (like JSF does) would be perfect.
> Struts-Faces uses the action-formbean-connection, like Struts does.

This particular use case benefits from one of the features of the
Shale framework (my proposal for the future of Struts), which is based
on JSF.  Starting point:

  http://wiki.apache.org/struts/StrutsShale

The key is that the prerender() method of the ViewController bean
associated with your productlist.jsp page is called, just before
rendering, no matter how you navigated to it (or where you came from).
 This is the right place to do the database search that actually
populates the product list table that is being generated.

Craig



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 12:27 AM
To: MyFaces Discussion
Subject: RE: Strange navigation in MyFaces examples



Yes, that looks like a solution for (rare) additional cases, but not for the 
usual success or failure case. Using a response
redirect for every request really is quite a lot traffic overhead.

The way Struts is dealing with this navigation issue, looks quite satisfying. 
There the URL actually chooses the navigation case /
action (e.g. "/productlist.do"). So using the Struts-JSF-integration-library 
(Struts-Faces) seems like a solution.

But with Struts - and Struts-Faces as well - there comes the next problem:
There the form bean is associated with the action, not with the form, as with 
JSF.

So e.g. you have an action, which shows a product list, called through URL 
"/productlist.do".
This URL/action can be called from a menu, from a book detail form (when 
saving) and from a cd detail form (saving).
So it doesn't make sense to associate this action with one specific form bean 
since there are already two different beans used with
this call (and one call using no bean at all).
Connecting the bean directly to the form (like JSF does) would be perfect.
Struts-Faces uses the action-formbean-connection, like Struts does.

So whichever way I use, there is always a problem.
Ok, I'm quite new to Struts and JSF - maybe I'm wrong or maybe there is a 
solution having the navigation case / action chosen
through the URL and having the form bean connected to the form at the same time.

Does anyone have an idea about this?

Thanks,
Chily



-----Original Message-----
From: Martin Marinschek [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 13, 2005 10:33 PM
To: MyFaces Discussion
Subject: Re: Strange navigation in MyFaces examples


well, that is a lot of traffic overhead you are generating there ;)

regards,

Martin


On Sun, 13 Mar 2005 22:22:26 +0100, Slawek <[EMAIL PROTECTED]> wrote:
> there IS solution to see actual url (not previous)!
>
>         <navigation-case>
>                 <from-outcome>somme_string</from-outcome>
>                 <to-view-id>/somme_page.jsp</to-view-id>
>                 <redirect/>
>         </navigation-case>
>
> notice redirect tag...
> its slower than without that tag but less confusing:P
>
>
> Slawek
>
>
> > Hi Martin,
> >
> > thanks for your fast answers :-)
> >
> > True, that the displayed page depends on the servlet's flexible redirect
> > mechanism.
> > But in most cases, you just have the distinction between success and
> > failure anyways. And in the failure case it wouldn't matter to
> > have an URL pointing to the success page, but actually displaying an
> > error page.
> >
> > Selecting the "navigation case" (see faces config xml) through the page
> > URL instead of a query parameter would help already. But
> > that's not possible, right?
> >
> > Chily
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Martin Marinschek [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, March 13, 2005 7:48 PM
> > To: MyFaces Discussion
> > Subject: Re: Strange navigation in MyFaces examples
> >
> >
> > No, as far as I know of, this is the one and only navigation concept
> > of JSF, and it can cause major troubles for example in security
> > filters....
> >
> > But there is no way around that if you don't want to specify the next
> > page the user gets to already in the html the user receives - the way
> > JSF does it, the next page depends on where the faces-servlet
> > redirects you to.
> >
> > regards,
> >
> > Martin
> >
> > On Sun, 13 Mar 2005 19:42:29 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > wrote:
> >> Hello,
> >>
> >> trying the MyFaces examples myfaces-1.0.8-examples.gz, I've noticed
> >> it's strange navigation:
> >> The URL you see in the browser's address bar has nothing to do with the
> >> actually displayed JSP. Instead of that, the URL is
> > actually
> >> always pointing to the previously called JSP - where the call to the
> >> current JSP comes from.
> >>
> >> I know where this comes from: The form tags don't define an action - so
> >> they point to the current page itself.
> >> And I see, what actually defines the target of each call: The (hidden)
> >> post parameter "_link_hidden_".
> >>
> >> So the JSF controller servlet doesn't actually care, which URL is
> >> called - it just regards the mentioned parameter.
> >> This kind of navigation seems quite confusing to me.
> >>
> >> One of the three most important reasons for using JSF is to make
> >> navigation clearer (besides the model/view seperation and the
> >> provided components).
> >> E.g. defining the whole application's navigation just in xml files,
> >> which can be used with graphical tools, is a great advantage.
> >>
> >> But I think it's most important to have a clear relation between URL of
> >> a page and it's content. E.g. just think of the
> >> searchability through a search engine.
> >>
> >> I'm new to JSF, so my question:
> >> Is this the (one-and-only) navigation concept of JSF, or is this a
> >> special thing about MyFaces, and there alternative concepts as
> >> well?
> >> (I didn't find any alternatives so far.)
> >>
> >> Thanks,
> >> Chily

Reply via email to