Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui:repeat throw duplicate component id error when set jakarta.faces.PARTIAL_STATE_SAVING=false in web.xml #5233

Closed
Harry3014 opened this issue May 5, 2023 · 5 comments
Labels

Comments

@Harry3014
Copy link

Harry3014 commented May 5, 2023

jsf-impl version

I use wildfly27 and jsf-impl version is 4.0.0.SP01

To Reproduce

web.xml

<context-param>
  <param-name>jakarta.faces.PARTIAL_STATE_SAVING</param-name>
  <param-value>false</param-value>
</context-param>

view

<h:form id="form">
    <ui:repeat value="#{testBean.lists}" var="list">
        <h:selectOneListbox valueChangeListener="#{test.listener}" size="2">
            <f:selectItems value="#{list}" />
            <f:ajax process="@this" />
        </h:selectOneListbox>
    </ui:repeat>
</h:form>

model

@Named
@ViewScoped
public class TestBean {
    private static List<String> list1 = Arrays.asList("1", "2");
    private static List<String> list2 = Arrays.asList("3", "4");
    private static List<List<String>> lists = Arrays.asList(list1, list2);

    public void listener(ValueChangeEvent e) {
        message = (e.getOldValue() + " -> " + e.getNewValue());
    }

    public List<List<String>> getLists() {
      return lists;
    }
}

Exception

When I click one item then throw JSF1007 (duplicate component id error)

java.lang.IllegalStateException: Component ID form:j_idt4:j_idt6 has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:1167)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:1156)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:1156)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:1156)
at com.sun.faces.application.view.FaceletFullStateManagementStrategy.saveView(FaceletFullStateManagementStrategy.java:674)
at jakarta.faces.application.StateManager.getViewState(StateManager.java:243)
at com.sun.faces.context.PartialViewContextImpl.renderState(PartialViewContextImpl.java:493)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:310)
.....

Addition context
If set jakarta.faces.PARTIAL_STATE_SAVING=true, it works correctly.

@BalusC
Copy link
Contributor

BalusC commented May 13, 2023

Apart from the concrete problem, may I ask why exactly you're disabling partial state saving and thus using full state saving? Full state saving is discommended (de-facto deprecated) since introduction of partial state saving in JSF 2.0 and subject to be removed in a future Faces version because it's so inefficient and technically unnecessary. So I'm trying to understand use cases where it's still considered necessary (probably it's used as a work around against some problem in partial state saving?) so that we can improve Faces (e.g., fix that problem in partial state saving) in order to not make full state saving necessary anymore.

@BalusC
Copy link
Contributor

BalusC commented Jul 29, 2023

FSS will be deprecated in 4.1. See also jakartaee/faces#1829

@mnriem mnriem added the 4.0 label Sep 5, 2023
@mnriem
Copy link
Contributor

mnriem commented Sep 18, 2023

@Harry3014 As FSS will be deprecated in 4.1 / 5.0 can we close this out as won't fix and assume you are going to use PSS going forward? Or is there a specific reason for using FSS here?

@BalusC
Copy link
Contributor

BalusC commented Sep 23, 2023

If you wish to use Mojarra 4.0 with FSS for your specific use case, then use a minimum of Mojarra 4.0.0-M6. That's the last version on which your use case worked for me. It broke in 4.0.0-M7 and it appears to be another regression of #4808. Curious detail is that your use case works fine in latest 2.3.x and 3.0.x which is supposed to have the same fixes as 4.0.x related to #4808. I suspect something went wrong related to physical removal of JSP support in 4.0. But after debugging for over a hour I still couldn't figure out where it goes wrong. As FSS is going to be deprecated nonetheless I didn't feel like continuing. You're of course open to debug on your own with this new information and then create a PR on this.

Still I'd love to know and understand the reason to use FSS on your project as that's supposed to be completely unnecessary since JSF 2.0. If that was just a legacy which you forgot to migrate then ok just do it. But if that was to work around some bug which only surfaces when using PSS then by all means let us know so we can fix that bug and you can switch back to PSS.

@BalusC
Copy link
Contributor

BalusC commented Sep 16, 2024

Stale, closing off. Moreover FSS has been deprecated in 4.1 as per jakartaee/faces#1829

@BalusC BalusC closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants