我在 Richfaces4 和 JSF2 中使用拖放组件。
当我在目标面板中拖放动作(第一个面板)时,一切正常。但是当我尝试将对象(第二个面板)拖放到目标面板时。我得到以下异常:
例外
debug[16:27:48.572]: Server returned responseText: <?xml version='1.0' encoding='UTF-8'?> <partial-response><error><error-name>class java.lang.NullPointerException</error-name><error-message><![CDATA[]]></error-message></error></partial-response>
info [16:27:48.574]: Element error
<error><error-name>class java.lang.NullPointerException</error-name><error-message><![CDATA[]]></error-message></error>
debug[16:27:48.574]: richfaces.queue: ajax submit error
debug[16:27:48.575]: richfaces.queue: Nothing to submit
error[16:27:48.576]: Received 'error@serverError' event from <div id=dropForm:list:0:j_idt42 class=rf-ind-drag ui-draggable ...>
error[16:27:48.577]: [200] class java.lang.NullPointerException:
源面板
<rich:panel id="Object">
    <h:dataTable value="#{dropBean.objects}" var="object">
        <h:column>
        <a4j:outputPanel layout="block">
             <rich:dragSource type="#{dropBean.objectType}" dragValue="#{object}" />
             <h:outputText value="#{object}"></h:outputText>
        </a4j:outputPanel>
        </h:column>
        </h:dataTable>
</rich:panel>
目标面板 1
<h:panelGrid columns="4">
    <rich:panel styleClass="idPanel" >
    <rich:panel>
    <rich:dropTarget acceptedTypes="ACTION" dropListener="#{dropBean.processDrop}" render="editPanel" />
    <rich:tooltip value="Drop here an Action..." />
    <a4j:outputPanel>
    <h:outputText value="#{dropBean.currentLine.action}"></h:outputText>
        </a4j:outputPanel>
    </rich:panel>
    <ui:include src="#{dropBean.pageByAction}" />
    <a4j:commandButton styleClass="opButtons" value="Add Step" action="#{dropBean.saveLine}" render="editPanel" />
</h:panelGrid>
<ui:include src="#{dropBean.pageByAction}" />根据我在第一个目标面板中放置的操作,该行会获得正确的页面。
这是包含页面的示例(目标面板 2):
目标面板 2
<h:panelGrid columns="3">
     <rich:panel styleClass="itemPanel" bodyClass="itemPanelBody">
     <rich:dropTarget acceptedTypes="OBJECT" dropListener="#{dropBean.processDrop}" render="@form" />
     <rich:tooltip value="Drop here an Object..." />
     <a4j:outputPanel>
     <h:outputText value="#{dropBean.currentLine.object}" />
     </a4j:outputPanel>
     </rich:panel>
</h:panelGrid>
如果我删除<ui:include src="#{dropBean.pageByAction}" />并直接插入代码,则删除操作可以正常工作。但是通过这种方式,面板不是动态的。我需要根据我选择的操作生成面板。
我已经尝试过但不起作用的其他事情:
- 插入 render="@form" "formName" "@all" 试图渲染所有页面。
 - 更改其他组件的数据表,例如 rich:list 和 rich:dataGrid
 - 在放置目标组件中使用立即。
 
提前致谢,