Hi,
I'm currently in the process of implementing a project for a client. Sadly, I've run into a snag that I can't figure out a workaround for. I'm using JSF2 which has a shortcoming: using c:forEach breaks viewscope, which is vital for the page I'm creating.
I'm trying to set up an accordionpanel, that has dynamic tabs based on a selection in a dropdown box at the top of the page. I wanted to add the tabs using ui:repeat but this doesn't work. In another forum topic (http://primefaces.prime.com.tr/forum/vi ... w=previous), Cagatay suggested using c:forEach. But as I described above, I can't use it as it breaks viewscope. How can I work around this? I really need to use this panel as it is a user requirement.
Thanks,
Jarno
Dynamic AccordionPanel & ViewScope
You can use session scope or conversion scope if you use CDI.
It doesn't sound like a major issue, but I agree that the c repeat is a problematic solution and should be handle by a dedicated component instead, similar to the columns component for dynamic columns in a data table.
Cheers,
Tamir
It doesn't sound like a major issue, but I agree that the c repeat is a problematic solution and should be handle by a dedicated component instead, similar to the columns component for dynamic columns in a data table.
Cheers,
Tamir
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
If c:forEach breaks viewscope then I suggest filing a bug to the jsf implementation you are using (mojarra or myfaces).
the sad thing is that this is a know issue and the suggested solution is to us the ui repeat
http://stackoverflow.com/questions/2842 ... ry-request
http://stackoverflow.com/questions/2842 ... ry-request
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
-
- Posts: 280
- Joined: 25 Jun 2010, 01:18
it just another reason to eliminate all the JSTL stuffs in Facelets.
Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Problem is ui:repeat only works on components with Renderer, p:tab has none.
-
- Posts: 18
- Joined: 02 Nov 2010, 18:19
Hi all,
Session scope is not acceptable as it is too wide a scope to use for this usecase. I've fixed the problem for now by switching to request scope, and instead of using the dropdown and form submits I'm using hyperlinks to the page in question.
For some strange reason, submitting the form to the same page causes the accordionPanel not to rerender properly, leaving me with serveral empty items.
I am not using CDI, and can't move to CDI either. I understand that if ViewScope is broken by JSF, then the normal cause of action would be posting a bug there. As another user has pointed out already, that has been done, but looking at the bug report and the comments I don't see this being fixed in the near future. I however feel that JSTL should not be used in the confines of JSF, that's why I'm asking the question here. Could Primefaces be adapted to support ui:repeat in this case? I think it would be a valid design decision to do so. I usually try to stay as far away from jstl as I possibly can, mainly because of issues like the one I'm facing now.
Thanks for the quick replies though, and the suggestions. It's good to see active communities on the web
Cheers,
Jarno
Session scope is not acceptable as it is too wide a scope to use for this usecase. I've fixed the problem for now by switching to request scope, and instead of using the dropdown and form submits I'm using hyperlinks to the page in question.
For some strange reason, submitting the form to the same page causes the accordionPanel not to rerender properly, leaving me with serveral empty items.
I am not using CDI, and can't move to CDI either. I understand that if ViewScope is broken by JSF, then the normal cause of action would be posting a bug there. As another user has pointed out already, that has been done, but looking at the bug report and the comments I don't see this being fixed in the near future. I however feel that JSTL should not be used in the confines of JSF, that's why I'm asking the question here. Could Primefaces be adapted to support ui:repeat in this case? I think it would be a valid design decision to do so. I usually try to stay as far away from jstl as I possibly can, mainly because of issues like the one I'm facing now.
Thanks for the quick replies though, and the suggestions. It's good to see active communities on the web
Cheers,
Jarno
-
- Posts: 18
- Joined: 02 Nov 2010, 18:19
Thought I'd look in again, as this is important to the project I'm working on... sadly no new replies. Anyone with any revelations that could help me?
-
- Posts: 7
- Joined: 11 Nov 2010, 21:12
I'm stuck at the same point. I found the following - performance degrading - work around:
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
to work well when using c:forEach.
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
to work well when using c:forEach.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 40 guests