0
我試圖從<p:dataTable>
編輯行n調用bean方法,但問題是bean方法沒有在rowEdit
事件中被調用。如果有人能給我解決方案,這將是可觀的。Bean方法對p:dataTable的rowEdit事件沒有被調用
此外,我的bean已經在視圖範圍,甚至不會在會話範圍內工作...我已經嘗試了所有三個範圍。
我的代碼給出如下:
<h:form id="commentList">
<p:dataTable id="commentTable" editable="true" paginator="true" rows="10" var="comment" value="#{commentAction.list(uID)}" class="table table-striped table-bordered table-hover commentTable" widgetVar="commentListTable">
<p:ajax event="rowEdit" listener="#{commentAction.updateCommentStatus}"/>
<p:column filterBy="#{comment.commentId}" footerText="" headerText="Comment Id" filterMatchMode="contains" sortBy="#{comment.commentId}">
<h:outputText value="#{comment.commentId}" id="commentId"/>
</p:column>
<p:column filterBy="#{comment.selectedText}" headerText="Selected Text" sortBy="#{comment.selectedText}">
<h:outputText value="#{comment.selectedText}" id="selectedText"/>
</p:column>
<p:column filterBy="#{comment.commentText}" headerText="Comment" sortBy="#{comment.commentText}">
<h:outputText value="#{comment.commentText}" id="commentText" escape="false"/>
</p:column>
<p:column filterBy="" headerText="Comment From" sortBy="">
<h:outputText value="" id="commentFrom"/>
</p:column>
<p:column filterBy="#{comment.insertedOn}" headerText="Date/Time" sortBy="#{comment.insertedOn}">
<h:outputText value="#{comment.insertedOn}" id="insertedOn"/>
</p:column>
<p:column filterBy="#{comment.commentStatus}" headerText="Comment Status" sortBy="#{comment.commentStatus}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{comment.commentStatus}" id="commSatus"/>
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{commentAciton.commentStatus}" id="commentStatus" class="commentSelectBox">
<f:selectItem itemLabel="UpdateStatus" itemDisabled="true"/>
<f:selectItem itemValue="Open" itemLabel="Open"/>
<f:selectItem itemValue="Close" itemLabel="Close"/>
<f:selectItem itemValue="Cancel" itemLabel="Cancel"/>
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
</h:form>
和豆腐的方法是:
public void updateCommentStatus(RowEditEvent event) {
try {
logger.info("comment Iddddddddddd: " + commentId);
logger.info("comment Statusssssss: " + this.commentStatus);
Comment comment = (Comment) event.getObject();
logger.info("new value: " + comment.getCommentStatus());
} catch (Exception ex) {
logger.info("Exception caught in updateCommentStatus in CommentAction ..." + ex.getMessage());
ex.printStackTrace();
}
}
的XHTML代碼不能被解析。標籤''不整潔,最後缺少'>'。這是你的真實代碼嗎?在這種情況下,''無關,但'聽衆'不會導航到所述的導航案例結果'成功'。它基本上期望在關聯的後臺bean中有一個'void'方法。與'action'不同,返回類型將被忽略。 –
Tiny
2015-01-21 05:10:52
@Tiny:>的標記寫錯了...還從bean方法中刪除返回標記,函數仍然沒有被調用...編輯上面的bean方法... 但現在我得到異常: –
Khushboo
2015-01-21 05:39:09
com.sun .faces.context.AjaxExceptionHandlerImpl handlePartialResponseError SEVERE:javax.faces.model.NoRowAvailableException 是否有人可以幫助 – Khushboo 2015-01-21 05:45:09