2

I'm getting the below error when I click "back button" in browser

   Component ID "prodRunsList:prodRunIdss" has already been found in the view. JSF 2.1.

Below is the code causing that exception

where (prodRunsList:prodRunIdss" )prodRunsList.xhtml and prodRunIdss is f:param under "command link"

   <h:commandLink value="view" action="select">
    <f:param id="prodRunIdss" name="prodRunId" value="#{prodRun.prodRunId}"/>
    </h:commandLink>

Notes:

I have "SearchForm.xhtml" page where I can input some values and on search event I'm navigating to "ResultDisplay.xhtml" page to dispaly retrieved records where at end of each record I'm having link to edit that row.by clicking the edit link which is navigating to "update page" here when i click back button in browser I'm getting the above error..

my sample code here

<c:forEach items="#{prodRuns}" var="prodRun">
                        <p:row>
                            <p:column>
                                <h:outputText value="#{prodRun.diameter}" />
                            </p:column>
                            <p:column>
                                <h:outputText value="#{prodRun.partyName}" />
                            </p:column>
                            <p:column>
                                <h:outputText value="#{prodRun.millAndCounts}" />
                            </p:column>
                            <p:column>
                                <h:outputText value="#{prodRun.fabric}" />
                            </p:column>

                            <p:column>
                                <h:outputText value="#{prodRun.nightRun}" />
                            </p:column>
                            <p:column>                                  
                                <h:commandLink value="view" action="select">
                                    <f:param id="prodRunIdsss" name="prodRunId" value="#{prodRun.prodRunId}"/>
                                </h:commandLink>
                            </p:column>
                        </p:row>
                    </c:forEach>
Manu
  • 3,179
  • 23
  • 57
  • 69

1 Answers1

1

This is recognizable as a state management bug in Mojarra when JSTL tags play a role in building/restoring the view. We have also faced this a couple of months ago at zeef.com which got solved after upgrading 2.1.21 to 2.1.24. I can't point out the exact issue ticket, but it's at least fixed somewhere in between those versions. Try upgrading to latest 2.1 version, which is currently already 2.1.26.

However, you've there basically a design/usability problem. You should be using a GET request instead of a POST request here.

Replace

<h:commandLink value="view" action="select">
    <f:param id="prodRunIdsss" name="prodRunId" value="#{prodRun.prodRunId}"/>
</h:commandLink>

by

<h:link value="view" outcome="select">
    <f:param id="prodRunIdsss" name="prodRunId" value="#{prodRun.prodRunId}"/>
</h:link>

It should also instantly fix this exception without the need to upgrade. Additional bonus, the link is now idempotent and thus bookmarkable and searchbot-crawlable.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555