You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jeremy Sager <js...@chessys.com> on 2006/03/24 19:41:51 UTC

A dynamic component and the JSF lifecycle

Thanks in advance for any help guys :-)
 
I am using an ADF showOneTab component that has a varying number of tabs. I
iterate across a list inside the xhtml document with a facelets tag.
 
In theory, a user may be able to click on various command items such as
links and buttons that would cause an item to be added to my list and a
navigate-back-to-self situation, which means that the new tabs should show
up.
 
The problem is, it doesn't work like that, and I think I know why.
 
My list isn't going to get updated until the Invoke Application phase, by
which point the component hierarchy is already built.
 
That's the problem. I think. What I actually see is really spotty behavior,
where sometimes things appear and other times they don't, and I can't tell
why. Regardless of the behavior, if I just hit the refresh button, the page
always loads exactly the way it should.
 
Here are my tags:
 
<af:showOneTab position="above">
<c:forEach var = "editorinput" items="#{editorPanelBean.tabs}" >
<af:showDetailItem text="#{editorinput.label}" id="#{editorinput.id}">
<ui:include src="#{editorinput.page}">
<ui:param name="editorinput" value="#{editorinput}"/>
</ui:include>
</af:showDetailItem>
</c:forEach>
</af:showOneTab>
 
 
 
Does anyone have any advice on how I should proceed here?  
 
I was thinking that the answer may be to write a custom phase listener and
figure out how to process my action early, which I'm more than happy to do
if it's the correct solution. I just don't want to go barking up the wrong
tree, or down a dead end alley, or whatever analogy you prefer if there's a
"duh" solution to this problem out there.
 
And remember I'm running that c:forEach in the facelets world, not the JSP
world.
 
Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
JSager@chessys.com 

RE: A dynamic component and the JSF lifecycle

Posted by Jeremy Sager <js...@chessys.com>.
Hi Adam - 

Thanks for the response.

What you are saying actually makes a ton of sense, seeing as how the
components show up some of the time.

I am indeed setting a unique id on the showDetailItems... I store them on
the "editorinput" objects because I may need to find them later if the user
has clicked the "close tab" button.

I am going to upgrade to the latest version of MyFaces and Facelets since
I'm back in November versions, but if that doesn't fix my problems, this
leaves me at square one.

I'll let you know, I appreciate the advice there.

Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
JSager@chessys.com
-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Saturday, March 25, 2006 6:12 PM
To: MyFaces Discussion
Subject: Re: A dynamic component and the JSF lifecycle

Indeed:  with Facelets, JSTL tags like c:forEach do generally work.
But it does get tricky when you're changing the number of
components from one request to the next.

What should be happening is that during Render Response,
the tags re-execute, and if there's a new component, it gets inserted -
especially if you have "id" set uniquely on that showDetailItem, which it
looks like you do, though confirmation of that would be a good idea.

-- Adam


On 3/24/06, Jeremy Sager <js...@chessys.com> wrote:
>
>
>
> Correct me if I'm wrong, but facelets is supposed to specifically fix that
> problem, isn't it?
>
>
>
>
>
> Jeremy Sager
>
> Data Communications Product Manager
>
> Chesapeake System Solutions
>
> 410.356.6805 x120
>
> JSager@chessys.com
>
>  ________________________________
>
>
> From: Alexander Panzhin [mailto:jalexoid@balticum-tv.lt]
>  Sent: Friday, March 24, 2006 3:29 PM
>  To: MyFaces Discussion
>  Subject: Re: A dynamic component and the JSF lifecycle
>
>
>
>
> Sorry to break it to you, but JSTL Core tags do not work well with JSF.
>  Usually they're "late".
>  In the sense that you have to refresh to get a correct view.
>  That's because they're rendered at different times.
>
>
>
>
> Thanks in advance for any help guys J
>
>
>
> I am using an ADF showOneTab component that has a varying number of tabs.
I
> iterate across a list inside the xhtml document with a facelets tag.
>
>
>
> In theory, a user may be able to click on various command items such as
> links and buttons that would cause an item to be added to my list and a
> navigate-back-to-self situation, which means that the new tabs should show
> up.
>
>
>
> The problem is, it doesn't work like that, and I think I know why.
>
>
>
> My list isn't going to get updated until the Invoke Application phase, by
> which point the component hierarchy is already built.
>
>
>
> That's the problem. I think. What I actually see is really spotty
behavior,
> where sometimes things appear and other times they don't, and I can't tell
> why. Regardless of the behavior, if I just hit the refresh button, the
page
> always loads exactly the way it should.
>
>
>
> Here are my tags:
>
>
>
> <af:showOneTab position="above">
>
> <c:forEach var = "editorinput" items="#{editorPanelBean.tabs}" >
>
> <af:showDetailItem text="#{editorinput.label}" id="#{editorinput.id}">
>
> <ui:include src="#{editorinput.page}">
>
> <ui:param name="editorinput" value="#{editorinput}"/>
>
> </ui:include>
>
> </af:showDetailItem>
>
> </c:forEach>
>
> </af:showOneTab>
>
>
>
>
>
>
>
> Does anyone have any advice on how I should proceed here?
>
>
>
> I was thinking that the answer may be to write a custom phase listener and
> figure out how to process my action early, which I'm more than happy to do
> if it's the correct solution. I just don't want to go barking up the wrong
> tree, or down a dead end alley, or whatever analogy you prefer if there's
a
> "duh" solution to this problem out there.
>
>
>
> And remember I'm running that c:forEach in the facelets world, not the JSP
> world.
>
>
>
>
> Jeremy Sager
>
> Data Communications Product Manager
>
> Chesapeake System Solutions
>
> 410.356.6805 x120
>
> JSager@chessys.com
>
>
>
>
>  --
>    Su pagarba,
>       Aleksandr Panzin
>       IT sistemu architektas.
>
>    With best regards,
>       Alexander Panzhin
>       IT systems architect
>


Re: A dynamic component and the JSF lifecycle

Posted by Adam Winer <aw...@gmail.com>.
Indeed:  with Facelets, JSTL tags like c:forEach do generally work.
But it does get tricky when you're changing the number of
components from one request to the next.

What should be happening is that during Render Response,
the tags re-execute, and if there's a new component, it gets inserted -
especially if you have "id" set uniquely on that showDetailItem, which it
looks like you do, though confirmation of that would be a good idea.

-- Adam


On 3/24/06, Jeremy Sager <js...@chessys.com> wrote:
>
>
>
> Correct me if I'm wrong, but facelets is supposed to specifically fix that
> problem, isn't it?
>
>
>
>
>
> Jeremy Sager
>
> Data Communications Product Manager
>
> Chesapeake System Solutions
>
> 410.356.6805 x120
>
> JSager@chessys.com
>
>  ________________________________
>
>
> From: Alexander Panzhin [mailto:jalexoid@balticum-tv.lt]
>  Sent: Friday, March 24, 2006 3:29 PM
>  To: MyFaces Discussion
>  Subject: Re: A dynamic component and the JSF lifecycle
>
>
>
>
> Sorry to break it to you, but JSTL Core tags do not work well with JSF.
>  Usually they're "late".
>  In the sense that you have to refresh to get a correct view.
>  That's because they're rendered at different times.
>
>
>
>
> Thanks in advance for any help guys J
>
>
>
> I am using an ADF showOneTab component that has a varying number of tabs. I
> iterate across a list inside the xhtml document with a facelets tag.
>
>
>
> In theory, a user may be able to click on various command items such as
> links and buttons that would cause an item to be added to my list and a
> navigate-back-to-self situation, which means that the new tabs should show
> up.
>
>
>
> The problem is, it doesn't work like that, and I think I know why…
>
>
>
> My list isn't going to get updated until the Invoke Application phase, by
> which point the component hierarchy is already built.
>
>
>
> That's the problem… I think. What I actually see is really spotty behavior,
> where sometimes things appear and other times they don't, and I can't tell
> why. Regardless of the behavior, if I just hit the refresh button, the page
> always loads exactly the way it should.
>
>
>
> Here are my tags:
>
>
>
> <af:showOneTab position="above">
>
> <c:forEach var = "editorinput" items="#{editorPanelBean.tabs}" >
>
> <af:showDetailItem text="#{editorinput.label}" id="#{editorinput.id}">
>
> <ui:include src="#{editorinput.page}">
>
> <ui:param name="editorinput" value="#{editorinput}"/>
>
> </ui:include>
>
> </af:showDetailItem>
>
> </c:forEach>
>
> </af:showOneTab>
>
>
>
>
>
>
>
> Does anyone have any advice on how I should proceed here?
>
>
>
> I was thinking that the answer may be to write a custom phase listener and
> figure out how to process my action early, which I'm more than happy to do
> if it's the correct solution. I just don't want to go barking up the wrong
> tree, or down a dead end alley, or whatever analogy you prefer if there's a
> "duh" solution to this problem out there.
>
>
>
> And remember I'm running that c:forEach in the facelets world, not the JSP
> world.
>
>
>
>
> Jeremy Sager
>
> Data Communications Product Manager
>
> Chesapeake System Solutions
>
> 410.356.6805 x120
>
> JSager@chessys.com
>
>
>
>
>  --
>    Su pagarba,
>       Aleksandr Panzin
>       IT sistemu architektas.
>
>    With best regards,
>       Alexander Panzhin
>       IT systems architect
>

RE: A dynamic component and the JSF lifecycle

Posted by Jeremy Sager <js...@chessys.com>.
Correct me if I'm wrong, but facelets is supposed to specifically fix that
problem, isn't it?
 
Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
JSager@chessys.com
  _____  

From: Alexander Panzhin [mailto:jalexoid@balticum-tv.lt] 
Sent: Friday, March 24, 2006 3:29 PM
To: MyFaces Discussion
Subject: Re: A dynamic component and the JSF lifecycle
 
Sorry to break it to you, but JSTL Core tags do not work well with JSF.
Usually they're "late".
In the sense that you have to refresh to get a correct view.
That's because they're rendered at different times.



Thanks in advance for any help guys :-)
 
I am using an ADF showOneTab component that has a varying number of tabs. I
iterate across a list inside the xhtml document with a facelets tag.
 
In theory, a user may be able to click on various command items such as
links and buttons that would cause an item to be added to my list and a
navigate-back-to-self situation, which means that the new tabs should show
up.
 
The problem is, it doesn't work like that, and I think I know why.
 
My list isn't going to get updated until the Invoke Application phase, by
which point the component hierarchy is already built.
 
That's the problem. I think. What I actually see is really spotty behavior,
where sometimes things appear and other times they don't, and I can't tell
why. Regardless of the behavior, if I just hit the refresh button, the page
always loads exactly the way it should.
 
Here are my tags:
 
<af:showOneTab position="above">
<c:forEach var = "editorinput" items="#{editorPanelBean.tabs}" >
<af:showDetailItem text="#{editorinput.label}" id="#{editorinput.id}">
<ui:include src="#{editorinput.page}">
<ui:param name="editorinput" value="#{editorinput}"/>
</ui:include>
</af:showDetailItem>
</c:forEach>
</af:showOneTab>
 
 
 
Does anyone have any advice on how I should proceed here?  
 
I was thinking that the answer may be to write a custom phase listener and
figure out how to process my action early, which I'm more than happy to do
if it's the correct solution. I just don't want to go barking up the wrong
tree, or down a dead end alley, or whatever analogy you prefer if there's a
"duh" solution to this problem out there.
 
And remember I'm running that c:forEach in the facelets world, not the JSP
world.
 
Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
JSager@chessys.com 




-- 
   Su pagarba,
      Aleksandr Panzin
      IT sistemu architektas.
 
   With best regards,
      Alexander Panzhin
      IT systems architect 

Re: A dynamic component and the JSF lifecycle

Posted by Alexander Panzhin <ja...@balticum-tv.lt>.
Sorry to break it to you, but JSTL Core tags do not work well with JSF.
Usually they're "late".
In the sense that you have to refresh to get a correct view.
That's because they're rendered at different times.

> Thanks in advance for any help guys J
>
>  
>
> I am using an ADF showOneTab component that has a varying number of 
> tabs. I iterate across a list inside the xhtml document with a 
> facelets tag.
>
>  
>
> In theory, a user may be able to click on various command items such 
> as links and buttons that would cause an item to be added to my list 
> and a navigate-back-to-self situation, which means that the new tabs 
> should show up.
>
>  
>
> The problem is, it doesn't work like that, and I think I know why...
>
>  
>
> My list isn't going to get updated until the Invoke Application phase, 
> by which point the component hierarchy is already built.
>
>  
>
> That's the problem... I think. What I actually see is really spotty 
> behavior, where sometimes things appear and other times they don't, 
> and I can't tell why. Regardless of the behavior, if I just hit the 
> refresh button, the page always loads exactly the way it should.
>
>  
>
> Here are my tags:
>
>  
>
> <af:showOneTab position="above">
>
> <c:forEach var = "editorinput" items="#{editorPanelBean.tabs}" >
>
> <af:showDetailItem text="#{editorinput.label}" id="#{editorinput.id}">
>
> <ui:include src="#{editorinput.page}">
>
> <ui:param name="editorinput" value="#{editorinput}"/>
>
> </ui:include>
>
> </af:showDetailItem>
>
> </c:forEach>
>
> </af:showOneTab>
>
>  
>
>  
>
>  
>
> Does anyone have any advice on how I should proceed here?  
>
>  
>
> I was thinking that the answer may be to write a custom phase listener 
> and figure out how to process my action early, which I'm more than 
> happy to do if it's the correct solution. I just don't want to go 
> barking up the wrong tree, or down a dead end alley, or whatever 
> analogy you prefer if there's a "duh" solution to this problem out there.
>
>  
>
> And remember I'm running that c:forEach in the facelets world, not the 
> JSP world.
>
>  
>
> Jeremy Sager
>
> Data Communications Product Manager
>
> Chesapeake System Solutions
>
> 410.356.6805 x120
>
> JSager@chessys.com <ma...@chessys.com>
>


-- 
   Su pagarba,
      Aleksandr Panzin
      IT sistemu architektas.

   With best regards,
      Alexander Panzhin
      IT systems architect