You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-dev@incubator.apache.org by Cosma Colanicchia <co...@gmail.com> on 2006/06/15 11:11:08 UTC

PageFlowScope and framesets bug?

Hello,

I have a problem using PageFlowScope when the dialog contains a
frameset. I explain what I'm doing:

I have an <af:table> that launch a dialog in a child window when the
user click on a row.

<af:commandLink text="Edit" useWindow="true"
action="#{peopleActions.editPerson}">
  <af:setActionListener from="#{person.personId}"
to="#{pageFlowScope.personId}"/>
</af:commandLink>

In the action method, I put an object in the PageFlowScope and return
a dialog:* outcome.

public String editPerson() {
  Integer personId = (Integer) getPageFlowAttribute("personId");
  PersonDTO person = PeopleFacadeUtil.getFacade().getPersonDetails(personId);
  setPageFlowAttribute("person", person);
  return "dialog:editPerson";
}

My navigation rule point to a frameset page:

<navigation-rule>
  <navigation-case>
    <from-action>#{peopleActions.editPerson}</from-action>
    <from-outcome>dialog:editPerson</from-outcome>
    <to-view-id>/people/edit/frameset.jspx</to-view-id>
  </navigation-case>
</navigation-rule>

And my frameset is defined like this:

<afh:frameBorderLayout>
  <f:facet name="top">
    <afh:frame
          source="/faces/people/edit/top.jspx" name="editPersonTop"
height="350px" />
    </f:facet>
    <f:facet name="bottom">
      <afh:frame
          source="/faces/people/edit/edit.jspx"
name="editPersonContent" height="*" />
    </f:facet>
</afh:frameBorderLayout>


The problem is that inside the top.jspx and edit.jspx, the
PageFlowScope "person" attribute is lost. If I skip the frameset and
navigate directly to one of the two, the object is there.

My guess is that the <af:frame> component doesn't pass throught the
_afPfm parameter when loading the view defined in "source", so the
correct pageFlowScope can't be determined.

Can this be considered a bug?

Thanks
Cosma

Re: PageFlowScope and framesets bug?

Posted by Cosma Colanicchia <co...@gmail.com>.
The ViewHandler getActionUrl() is doing it too, so the prefix is added
twice.. see point 7.5.2 of JSF 1.1 specs:

"The getActionURL() method must fulfill the following responsibilities:
[...] If prefix mapping (such as "/faces/*") is used for FacesServlet,
prepend the context path of the current application [...] If suffix mapping
(such as "*.faces") is used for FacesServlet, and the specified
viewId ends with the specified suffix, [...] prefix this value with the
context path for the current web application, and return the result."

Anyway, this is just the way it is meant to be, so I think it's okay to
simply strip out one of the two :-)


Cosma


2006/6/20, Adam Winer <aw...@gmail.com>:
>
> Cosma,
>
> Any URL that begins with a slash - in any of our components - gets
> prefixed with the webapp context.  All JSF components should be
> doing this - the ones in the spec do, hopefully Tomahawk does as
> well.  It's not getActionUrl() that's being called.
>
> One poorly documented trick that Trinidad has is that a double
> slash gets trimmed down to a single slash, but unprefixed.
>
> -- Adam
>
>
> On 6/20/06, Cosma Colanicchia <co...@gmail.com> wrote:
> >
> > Mmm... when I use the source attribute of frame tag, it automatically
> > prefix the link with the current webapp context. Example
> > source="/faces/page.jspx" -> /webapp/faces/page.jspx.
> >
> > getActionUrl again does this, but only if using a mapping like /faces/
> > (by JSF spec 1.1).
> >
> > So using <afh:frame source="#{utils.actionUrl['/page.jspx']}"
> >
> > <afh:frame source="#{utils.actionUrl['/page.jspx']} ->
> >       [getActionUrl] ->/webapp/faces/page.jspx ->
> >             [source attr.] -> /webapp/webapp/faces/page.jspx
> >
> > I think the only way to go is to manually strip out that prefix after
> > calling getActionUrl, anyway I'm curious about the reasons of this
> > special behaviour in the specs.
> >
> > Cosma
> >
> >
> > 2006/6/19, Cosma Colanicchia <co...@gmail.com>:
> > > I get the point, thanks Adam. Probably it would be fine to have
> > > <af:frame> do it automatically, at least with an option.
> > >
> > > Cosma
> > >
> > >
> > > 2006/6/15, Adam Winer <aw...@gmail.com>:
> > > > Cosma,
> > > >
> > > > What you'll need to do is change:
> > > >  source="/faces/people/edit/top.jspx"
> > > > to
> > > >   source="#{...anELExpression..>}"
> > > >
> > > > ... where the EL expression uses ViewHandler.getActionURL().
> > > > If you're using Facelets, I'd register a custom EL function that
> > > > takes a viewID and calls ViewHandler.getActionURL(), so this'd
> > > > look like:
> > > >
> > > >   source="#{my:getViewUrl('/people/edit/top.jspx')}"
> > > >
> > > > (If you're not using Facelets, you can create a custom Map
> > > > implementation that has the same effect.)
> > > >
> > > > -- Adam
> > > >
> > > > On 6/15/06, Cosma Colanicchia <co...@gmail.com> wrote:
> > > > > Hello,
> > > > >
> > > > > I have a problem using PageFlowScope when the dialog contains a
> > > > > frameset. I explain what I'm doing:
> > > > >
> > > > > I have an <af:table> that launch a dialog in a child window when
> the
> > > > > user click on a row.
> > > > >
> > > > > <af:commandLink text="Edit" useWindow="true"
> > > > > action="#{peopleActions.editPerson}">
> > > > >   <af:setActionListener from="#{person.personId}"
> > > > > to="#{pageFlowScope.personId}"/>
> > > > > </af:commandLink>
> > > > >
> > > > > In the action method, I put an object in the PageFlowScope and
> > return
> > > > > a dialog:* outcome.
> > > > >
> > > > > public String editPerson() {
> > > > >   Integer personId = (Integer) getPageFlowAttribute("personId");
> > > > >   PersonDTO person = PeopleFacadeUtil.getFacade
> > ().getPersonDetails(personId);
> > > > >   setPageFlowAttribute("person", person);
> > > > >   return "dialog:editPerson";
> > > > > }
> > > > >
> > > > > My navigation rule point to a frameset page:
> > > > >
> > > > > <navigation-rule>
> > > > >   <navigation-case>
> > > > >     <from-action>#{peopleActions.editPerson}</from-action>
> > > > >     <from-outcome>dialog:editPerson</from-outcome>
> > > > >     <to-view-id>/people/edit/frameset.jspx</to-view-id>
> > > > >   </navigation-case>
> > > > > </navigation-rule>
> > > > >
> > > > > And my frameset is defined like this:
> > > > >
> > > > > <afh:frameBorderLayout>
> > > > >   <f:facet name="top">
> > > > >     <afh:frame
> > > > >           source="/faces/people/edit/top.jspx"
> name="editPersonTop"
> > > > > height="350px" />
> > > > >     </f:facet>
> > > > >     <f:facet name="bottom">
> > > > >       <afh:frame
> > > > >           source="/faces/people/edit/edit.jspx"
> > > > > name="editPersonContent" height="*" />
> > > > >     </f:facet>
> > > > > </afh:frameBorderLayout>
> > > > >
> > > > >
> > > > > The problem is that inside the top.jspx and edit.jspx, the
> > > > > PageFlowScope "person" attribute is lost. If I skip the frameset
> and
> > > > > navigate directly to one of the two, the object is there.
> > > > >
> > > > > My guess is that the <af:frame> component doesn't pass throught
> the
> > > > > _afPfm parameter when loading the view defined in "source", so the
> > > > > correct pageFlowScope can't be determined.
> > > > >
> > > > > Can this be considered a bug?
> > > > >
> > > > > Thanks
> > > > > Cosma
> > > > >
> > > >
> > >
> >
>
>

Re: PageFlowScope and framesets bug?

Posted by Adam Winer <aw...@gmail.com>.
Cosma,

Any URL that begins with a slash - in any of our components - gets
prefixed with the webapp context.  All JSF components should be
doing this - the ones in the spec do, hopefully Tomahawk does as
well.  It's not getActionUrl() that's being called.

One poorly documented trick that Trinidad has is that a double
slash gets trimmed down to a single slash, but unprefixed.

-- Adam


On 6/20/06, Cosma Colanicchia <co...@gmail.com> wrote:
>
> Mmm... when I use the source attribute of frame tag, it automatically
> prefix the link with the current webapp context. Example
> source="/faces/page.jspx" -> /webapp/faces/page.jspx.
>
> getActionUrl again does this, but only if using a mapping like /faces/
> (by JSF spec 1.1).
>
> So using <afh:frame source="#{utils.actionUrl['/page.jspx']}"
>
> <afh:frame source="#{utils.actionUrl['/page.jspx']} ->
>       [getActionUrl] ->/webapp/faces/page.jspx ->
>             [source attr.] -> /webapp/webapp/faces/page.jspx
>
> I think the only way to go is to manually strip out that prefix after
> calling getActionUrl, anyway I'm curious about the reasons of this
> special behaviour in the specs.
>
> Cosma
>
>
> 2006/6/19, Cosma Colanicchia <co...@gmail.com>:
> > I get the point, thanks Adam. Probably it would be fine to have
> > <af:frame> do it automatically, at least with an option.
> >
> > Cosma
> >
> >
> > 2006/6/15, Adam Winer <aw...@gmail.com>:
> > > Cosma,
> > >
> > > What you'll need to do is change:
> > >  source="/faces/people/edit/top.jspx"
> > > to
> > >   source="#{...anELExpression..>}"
> > >
> > > ... where the EL expression uses ViewHandler.getActionURL().
> > > If you're using Facelets, I'd register a custom EL function that
> > > takes a viewID and calls ViewHandler.getActionURL(), so this'd
> > > look like:
> > >
> > >   source="#{my:getViewUrl('/people/edit/top.jspx')}"
> > >
> > > (If you're not using Facelets, you can create a custom Map
> > > implementation that has the same effect.)
> > >
> > > -- Adam
> > >
> > > On 6/15/06, Cosma Colanicchia <co...@gmail.com> wrote:
> > > > Hello,
> > > >
> > > > I have a problem using PageFlowScope when the dialog contains a
> > > > frameset. I explain what I'm doing:
> > > >
> > > > I have an <af:table> that launch a dialog in a child window when the
> > > > user click on a row.
> > > >
> > > > <af:commandLink text="Edit" useWindow="true"
> > > > action="#{peopleActions.editPerson}">
> > > >   <af:setActionListener from="#{person.personId}"
> > > > to="#{pageFlowScope.personId}"/>
> > > > </af:commandLink>
> > > >
> > > > In the action method, I put an object in the PageFlowScope and
> return
> > > > a dialog:* outcome.
> > > >
> > > > public String editPerson() {
> > > >   Integer personId = (Integer) getPageFlowAttribute("personId");
> > > >   PersonDTO person = PeopleFacadeUtil.getFacade
> ().getPersonDetails(personId);
> > > >   setPageFlowAttribute("person", person);
> > > >   return "dialog:editPerson";
> > > > }
> > > >
> > > > My navigation rule point to a frameset page:
> > > >
> > > > <navigation-rule>
> > > >   <navigation-case>
> > > >     <from-action>#{peopleActions.editPerson}</from-action>
> > > >     <from-outcome>dialog:editPerson</from-outcome>
> > > >     <to-view-id>/people/edit/frameset.jspx</to-view-id>
> > > >   </navigation-case>
> > > > </navigation-rule>
> > > >
> > > > And my frameset is defined like this:
> > > >
> > > > <afh:frameBorderLayout>
> > > >   <f:facet name="top">
> > > >     <afh:frame
> > > >           source="/faces/people/edit/top.jspx" name="editPersonTop"
> > > > height="350px" />
> > > >     </f:facet>
> > > >     <f:facet name="bottom">
> > > >       <afh:frame
> > > >           source="/faces/people/edit/edit.jspx"
> > > > name="editPersonContent" height="*" />
> > > >     </f:facet>
> > > > </afh:frameBorderLayout>
> > > >
> > > >
> > > > The problem is that inside the top.jspx and edit.jspx, the
> > > > PageFlowScope "person" attribute is lost. If I skip the frameset and
> > > > navigate directly to one of the two, the object is there.
> > > >
> > > > My guess is that the <af:frame> component doesn't pass throught the
> > > > _afPfm parameter when loading the view defined in "source", so the
> > > > correct pageFlowScope can't be determined.
> > > >
> > > > Can this be considered a bug?
> > > >
> > > > Thanks
> > > > Cosma
> > > >
> > >
> >
>

Re: PageFlowScope and framesets bug?

Posted by Cosma Colanicchia <co...@gmail.com>.
Mmm... when I use the source attribute of frame tag, it automatically
prefix the link with the current webapp context. Example
source="/faces/page.jspx" -> /webapp/faces/page.jspx.

getActionUrl again does this, but only if using a mapping like /faces/
(by JSF spec 1.1).

So using <afh:frame source="#{utils.actionUrl['/page.jspx']}"

<afh:frame source="#{utils.actionUrl['/page.jspx']} ->
      [getActionUrl] ->/webapp/faces/page.jspx ->
            [source attr.] -> /webapp/webapp/faces/page.jspx

I think the only way to go is to manually strip out that prefix after
calling getActionUrl, anyway I'm curious about the reasons of this
special behaviour in the specs.

Cosma


2006/6/19, Cosma Colanicchia <co...@gmail.com>:
> I get the point, thanks Adam. Probably it would be fine to have
> <af:frame> do it automatically, at least with an option.
>
> Cosma
>
>
> 2006/6/15, Adam Winer <aw...@gmail.com>:
> > Cosma,
> >
> > What you'll need to do is change:
> >  source="/faces/people/edit/top.jspx"
> > to
> >   source="#{...anELExpression..>}"
> >
> > ... where the EL expression uses ViewHandler.getActionURL().
> > If you're using Facelets, I'd register a custom EL function that
> > takes a viewID and calls ViewHandler.getActionURL(), so this'd
> > look like:
> >
> >   source="#{my:getViewUrl('/people/edit/top.jspx')}"
> >
> > (If you're not using Facelets, you can create a custom Map
> > implementation that has the same effect.)
> >
> > -- Adam
> >
> > On 6/15/06, Cosma Colanicchia <co...@gmail.com> wrote:
> > > Hello,
> > >
> > > I have a problem using PageFlowScope when the dialog contains a
> > > frameset. I explain what I'm doing:
> > >
> > > I have an <af:table> that launch a dialog in a child window when the
> > > user click on a row.
> > >
> > > <af:commandLink text="Edit" useWindow="true"
> > > action="#{peopleActions.editPerson}">
> > >   <af:setActionListener from="#{person.personId}"
> > > to="#{pageFlowScope.personId}"/>
> > > </af:commandLink>
> > >
> > > In the action method, I put an object in the PageFlowScope and return
> > > a dialog:* outcome.
> > >
> > > public String editPerson() {
> > >   Integer personId = (Integer) getPageFlowAttribute("personId");
> > >   PersonDTO person = PeopleFacadeUtil.getFacade().getPersonDetails(personId);
> > >   setPageFlowAttribute("person", person);
> > >   return "dialog:editPerson";
> > > }
> > >
> > > My navigation rule point to a frameset page:
> > >
> > > <navigation-rule>
> > >   <navigation-case>
> > >     <from-action>#{peopleActions.editPerson}</from-action>
> > >     <from-outcome>dialog:editPerson</from-outcome>
> > >     <to-view-id>/people/edit/frameset.jspx</to-view-id>
> > >   </navigation-case>
> > > </navigation-rule>
> > >
> > > And my frameset is defined like this:
> > >
> > > <afh:frameBorderLayout>
> > >   <f:facet name="top">
> > >     <afh:frame
> > >           source="/faces/people/edit/top.jspx" name="editPersonTop"
> > > height="350px" />
> > >     </f:facet>
> > >     <f:facet name="bottom">
> > >       <afh:frame
> > >           source="/faces/people/edit/edit.jspx"
> > > name="editPersonContent" height="*" />
> > >     </f:facet>
> > > </afh:frameBorderLayout>
> > >
> > >
> > > The problem is that inside the top.jspx and edit.jspx, the
> > > PageFlowScope "person" attribute is lost. If I skip the frameset and
> > > navigate directly to one of the two, the object is there.
> > >
> > > My guess is that the <af:frame> component doesn't pass throught the
> > > _afPfm parameter when loading the view defined in "source", so the
> > > correct pageFlowScope can't be determined.
> > >
> > > Can this be considered a bug?
> > >
> > > Thanks
> > > Cosma
> > >
> >
>

Re: PageFlowScope and framesets bug?

Posted by Cosma Colanicchia <co...@gmail.com>.
I get the point, thanks Adam. Probably it would be fine to have
<af:frame> do it automatically, at least with an option.

Cosma


2006/6/15, Adam Winer <aw...@gmail.com>:
> Cosma,
>
> What you'll need to do is change:
>  source="/faces/people/edit/top.jspx"
> to
>   source="#{...anELExpression..>}"
>
> ... where the EL expression uses ViewHandler.getActionURL().
> If you're using Facelets, I'd register a custom EL function that
> takes a viewID and calls ViewHandler.getActionURL(), so this'd
> look like:
>
>   source="#{my:getViewUrl('/people/edit/top.jspx')}"
>
> (If you're not using Facelets, you can create a custom Map
> implementation that has the same effect.)
>
> -- Adam
>
> On 6/15/06, Cosma Colanicchia <co...@gmail.com> wrote:
> > Hello,
> >
> > I have a problem using PageFlowScope when the dialog contains a
> > frameset. I explain what I'm doing:
> >
> > I have an <af:table> that launch a dialog in a child window when the
> > user click on a row.
> >
> > <af:commandLink text="Edit" useWindow="true"
> > action="#{peopleActions.editPerson}">
> >   <af:setActionListener from="#{person.personId}"
> > to="#{pageFlowScope.personId}"/>
> > </af:commandLink>
> >
> > In the action method, I put an object in the PageFlowScope and return
> > a dialog:* outcome.
> >
> > public String editPerson() {
> >   Integer personId = (Integer) getPageFlowAttribute("personId");
> >   PersonDTO person = PeopleFacadeUtil.getFacade().getPersonDetails(personId);
> >   setPageFlowAttribute("person", person);
> >   return "dialog:editPerson";
> > }
> >
> > My navigation rule point to a frameset page:
> >
> > <navigation-rule>
> >   <navigation-case>
> >     <from-action>#{peopleActions.editPerson}</from-action>
> >     <from-outcome>dialog:editPerson</from-outcome>
> >     <to-view-id>/people/edit/frameset.jspx</to-view-id>
> >   </navigation-case>
> > </navigation-rule>
> >
> > And my frameset is defined like this:
> >
> > <afh:frameBorderLayout>
> >   <f:facet name="top">
> >     <afh:frame
> >           source="/faces/people/edit/top.jspx" name="editPersonTop"
> > height="350px" />
> >     </f:facet>
> >     <f:facet name="bottom">
> >       <afh:frame
> >           source="/faces/people/edit/edit.jspx"
> > name="editPersonContent" height="*" />
> >     </f:facet>
> > </afh:frameBorderLayout>
> >
> >
> > The problem is that inside the top.jspx and edit.jspx, the
> > PageFlowScope "person" attribute is lost. If I skip the frameset and
> > navigate directly to one of the two, the object is there.
> >
> > My guess is that the <af:frame> component doesn't pass throught the
> > _afPfm parameter when loading the view defined in "source", so the
> > correct pageFlowScope can't be determined.
> >
> > Can this be considered a bug?
> >
> > Thanks
> > Cosma
> >
>

Re: PageFlowScope and framesets bug?

Posted by Adam Winer <aw...@gmail.com>.
Cosma,

What you'll need to do is change:
 source="/faces/people/edit/top.jspx"
to
  source="#{...anELExpression..>}"

... where the EL expression uses ViewHandler.getActionURL().
If you're using Facelets, I'd register a custom EL function that
takes a viewID and calls ViewHandler.getActionURL(), so this'd
look like:

  source="#{my:getViewUrl('/people/edit/top.jspx')}"

(If you're not using Facelets, you can create a custom Map
implementation that has the same effect.)

-- Adam

On 6/15/06, Cosma Colanicchia <co...@gmail.com> wrote:
> Hello,
>
> I have a problem using PageFlowScope when the dialog contains a
> frameset. I explain what I'm doing:
>
> I have an <af:table> that launch a dialog in a child window when the
> user click on a row.
>
> <af:commandLink text="Edit" useWindow="true"
> action="#{peopleActions.editPerson}">
>   <af:setActionListener from="#{person.personId}"
> to="#{pageFlowScope.personId}"/>
> </af:commandLink>
>
> In the action method, I put an object in the PageFlowScope and return
> a dialog:* outcome.
>
> public String editPerson() {
>   Integer personId = (Integer) getPageFlowAttribute("personId");
>   PersonDTO person = PeopleFacadeUtil.getFacade().getPersonDetails(personId);
>   setPageFlowAttribute("person", person);
>   return "dialog:editPerson";
> }
>
> My navigation rule point to a frameset page:
>
> <navigation-rule>
>   <navigation-case>
>     <from-action>#{peopleActions.editPerson}</from-action>
>     <from-outcome>dialog:editPerson</from-outcome>
>     <to-view-id>/people/edit/frameset.jspx</to-view-id>
>   </navigation-case>
> </navigation-rule>
>
> And my frameset is defined like this:
>
> <afh:frameBorderLayout>
>   <f:facet name="top">
>     <afh:frame
>           source="/faces/people/edit/top.jspx" name="editPersonTop"
> height="350px" />
>     </f:facet>
>     <f:facet name="bottom">
>       <afh:frame
>           source="/faces/people/edit/edit.jspx"
> name="editPersonContent" height="*" />
>     </f:facet>
> </afh:frameBorderLayout>
>
>
> The problem is that inside the top.jspx and edit.jspx, the
> PageFlowScope "person" attribute is lost. If I skip the frameset and
> navigate directly to one of the two, the object is there.
>
> My guess is that the <af:frame> component doesn't pass throught the
> _afPfm parameter when loading the view defined in "source", so the
> correct pageFlowScope can't be determined.
>
> Can this be considered a bug?
>
> Thanks
> Cosma
>