我已经为一个特殊的userinput小部件创建了一个自定义的jsf2.0组件。
<cc:interface>
<cc:attribute name="value"></cc:attribute>
<cc:attribute name="editmode" default="true" type="java.lang.Boolean"></cc:attribute>
</cc:interface>
<cc:implementation>
....
</cc:implementation>该组件包含一些标准输入组件,并使用jsf2.0Ajax行为。我的组件中的一切都运行得很好,并且我在应用程序中多次使用它。
现在,当我使用带有f:ajax区域的组件时,我遇到了一个奇怪的问题。
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:marty="http://java.sun.com/jsf/composite/marty"
xmlns:h="http://java.sun.com/jsf/html">
<!-- Ajax region -->
<f:ajax>
<h:panelGroup id="timesheet_panel" binding="#{timesheetListComponent}">
.....
<!-- my custom component ->
<marty:userInput value="#{workitem.item['nammanager']}" editmode="true" />
....
<h:commandButton value="#{message.search}"
action="/pages/workitems/workitem"
actionListener="#{timesheetController.reset}">
<f:ajax render="timesheet_panel" onevent="updateTimesheetPanel" />
</h:commandButton>
....
</f:ajax>
</ui:composition>现在奇怪的是,当单击命令按钮并触发ajax请求时,我的自定义组件在我的表单中出现了3次。
有人能解释为什么会发生这种情况吗?
发布于 2013-07-31 15:03:26
我找到了这种奇怪行为的原因。这是一个JavaScript问题。我的组件包含jquery脚本来隐藏组件的某些部分。ajax调用完成后,jquery脚本没有被触发,因此组件的布局被破坏。所以这是一个javaScript问题,而不是我最初认为的jsf组件的问题。很抱歉问错了问题。
https://stackoverflow.com/questions/17963510
复制相似问题