所以,我遇到了一些关于Python中While循环的意外行为。
考虑以下代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
.....
<h:dataTable id="dttask"
binding="#{searchTask.taskTable.dataTable}"
value="#{searchTask.taskTable.dataList}" var="task"
styleClass="table table-striped table-hover">
<!--rowStyleClass="#{searchTask.hasLinkedDecision(task) ? 'info' : ''}"-->
<h:column>
<f:facet name="header">
<h:panelGroup>
.....
</h:panelGroup>
</f:facet>
<a href="${facesContext.externalContext.requestContextPath}/faces/pages/tasks/editing/add-tasks.xhtml?id=#{task.noTask}">
<h:outputText value="#{task.noTask}"/>
</a>
</h:column>
<h:column sortBy="">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="No CT"/>
</h:panelGroup>
</f:facet>
<h:panelGroup rendered="#{not empty searchTask.getNoCT(task)}">
<div class="tooltipobjet" tabindex="0"
style="border-bottom: 1px dotted black;">
.....
</div>
</h:panelGroup>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<abbr title="#{searchTask.getTaskLabel(task.principal)}">
.....
</abbr>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<h:outputText value="#{searchTask.getLabelValueDomainSearch('domain.type.task', task.type)}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<div class="tooltipobject" tabindex="0"
style="border-bottom: 1px dotted black;">
.....
</div>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<h:outputText value="#{task.dateConform}">
<f:convertDateTime pattern="#{constants.DATE_TIME_FORMAT_CREATE_JOUR_HH_MM}"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink
actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<h:outputText value="#{searchTask.getAdminUnitAbbr(task.treatingAdminUnit)}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:panelGroup>
<h:commandLink actionListener="#{searchTask.sortDataListTask}">
.....
</h:commandLink>
</h:panelGroup>
</f:facet>
<h:outputText value="#{searchTask.getLabelValueDomainStatusByUser(task.status, task.statusEditDate)}"/>
</h:column>
</h:dataTable>
.....
</html>
我希望将newarray重置为每次迭代时数组,数组保持不变。但是,在打印功能中,它们都会更改其值。 我已经使用复制模块解决了这个问题,但是我想知道为什么会这样吗?
如果将数组替换为int,其行为将与我期望的一样。