I was able to fix one instance of this problem by renaming a
commandButton. Clicking the submit button on version.jsp leads to
stringSearch.jsp (via the result from an action). The button on
version.jsp is viewRoot:dataForm:data:submit while the button on
stringSearch.jsp is viewRoot:searchView:searchDataForm:submit (which
looks unique to me when including the container's id). When the 2
buttons on different pages have the same name, the wrong components
sometimes get renedered in the wrong place (usually just the wrong
button but I have seen whole forms appear where they shouldn't). If I
make the submit button totally unique, then it seems to render
correctly.
Has anyone else seen this problem? Do id's have to be globablly unique
(this would be very cumbersome)?
On Fri, 25 Feb 2005 09:59:19 -0800, Mikey E <[EMAIL PROTECTED]> wrote:
> I seem to be getting an intermittent problem where components get
> rendered on the wrong page. My page will render as expected, except
> for the occasional extra component from a different page. I'm not
> dynamically adding components and I am explicitly setting the id (I've
> found not doing this causes more errors). I am binding forms to the
> backing bean but I'm just doing that to retrieve the form data (ie
> read only). I'm using 1.0.8 and server side state saving.
>
> Any ideas?
>
<[EMAIL PROTECTED] file="/common/include/headers.jsp" %>
<[EMAIL PROTECTED] file="/common/include/htmlBegin.jsp" %>
<[EMAIL PROTECTED] file="/common/include/htmlBody.jsp" %>
<f:view>
<[EMAIL PROTECTED] file="/common/include/menu.jsp" %>
<h:outputText styleClass="title2" value="Version" /><br />
<[EMAIL PROTECTED] file="/common/include/info.jsp" %>
<h:form id="dataForm" binding="#{versionBean.dataForm}">
<h:panelGrid id="data" columns="2">
<h:outputText id="idLabel" value="ID:" />
<h:inputText id="verId" disabled="true"
required="false" value="#{versionBean.model.versionID}" />
<h:outputText id="nameLabel" value="Name:" />
<h:inputText id="verName" required="true"
maxlength="#{versionBean.nameMaxLength}" value="#{versionBean.model.name}" />
<h:outputText id="productIdLabel"
value="Product ID:" />
<h:inputText id="prodId" disabled="true"
required="false" value="#{versionBean.model.product.productID}" />
<h:outputText id="dateLabel" value="DateAdded:"
/>
<h:inputText id="verDate" disabled="true"
required="true" value="#{versionBean.model.dateAdded}" />
<h:outputText id="activeLabel" value="Is
Active:" />
<h:selectBooleanCheckbox id="verActive"
required="false" value="#{versionBean.model.active}" />
<h:outputText value=" " escape="false" />
<h:commandButton id="submit"
action="#{versionBean.invoke}" value="#{versionBean.cmdLabel}" />
</h:panelGrid>
<h:inputHidden id="cmd" value="#{versionBean.cmd}" />
</h:form>
</f:view>
<[EMAIL PROTECTED] file="/common/include/htmlEnd.jsp" %><[EMAIL PROTECTED] file="/common/include/headers.jsp" %>
<[EMAIL PROTECTED] file="/common/include/htmlBegin.jsp" %>
<[EMAIL PROTECTED] file="/common/include/htmlBody.jsp" %>
<f:view>
<[EMAIL PROTECTED] file="/common/include/menu.jsp" %>
<h:outputText id="pageTitle" styleClass="title2"
value="Strings" /><br />
<[EMAIL PROTECTED] file="/common/include/info.jsp" %>
<h:form id="newForm" binding="#{stringBean.newForm}">
<h:commandButton id="submit"
action="#{stringBean.invoke}" value="Create New String" />
<h:inputHidden id="versionID"
value="#{stringSearchBean.versionID}" />
<h:inputHidden id="cmd" value="displayNew" />
</h:form>
<f:subview id="searchView">
<h:outputText id="titleText" styleClass="title3" value="Select
search crieria" /><br />
<h:form id="searchDataForm"
binding="#{stringSearchBean.searchForm}">
<h:outputText id="verLabel" value="Version ID:" />
<h:inputText id="verID" disabled="true"
required="false" value="#{stringSearchBean.versionID}" />
<br />
<h:outputText id="prodLabel" value="Product ID:" />
<h:inputText id="prodID" disabled="true"
required="false" value="#{stringSearchBean.productID}" />
<br />
<h:outputText id="startsLabel" value="Starts With:" />
<h:inputText id="startsWith" required="false"
value="#{stringSearchBean.startsWith}" />
<br />
<h:outputText id="resultsLabel" value="Max Results:" />
<h:inputText id="maxResults" required="false"
value="#{stringSearchBean.maxResults}" />
<br />
<h:outputText value=" " escape="false" />
<h:commandButton id="submit"
action="#{stringSearchBean.invoke}" value="Search" />
<br />
</h:form>
<h:outputText rendered="#{stringSearchBean.cmd ==
'displayResults'}"
styleClass="title3" escape="false"
value="Search results<br />" />
<h:outputText rendered="#{stringSearchBean.modelLength
== 0}"
escape="false" value="No results<br />" />
<h:outputText rendered="#{stringSearchBean.modelLength
> 0}"
escape="false" value=" results found<br />" />
<h:dataTable id="resultData"
value="#{stringsBean.model}" var="pestring"
styleClass="displayData"
columnClasses="idColumn, displayDataColumn, linkColumnSm" headerClass="title3"
rendered="#{stringSearchBean.modelLength > 0}">
<h:column id="columnId">
<h:outputText id="stringID"
value="#{pestring.stringID}" />
</h:column>
<h:column id="columnMacro">
<h:form id="editForm"
binding="#{stringBean.editForm}">
<h:commandLink id="submit"
action="#{stringBean.invoke}"
value="#{pestring.macro}" title="Edit this String" />
<h:inputHidden id="cmd"
value="displayEdit" />
<h:inputHidden id="stringID"
value="#{pestring.stringID}" />
<h:inputHidden id="verID"
value="#{stringSearchBean.versionID}" />
</h:form>
</h:column>
</h:dataTable>
</f:subview>
</f:view>
<[EMAIL PROTECTED] file="/common/include/htmlEnd.jsp" %>