【发布时间】:2012-09-19 09:40:19
【问题描述】:
当用户在我的应用程序中单击<h:commandLink> 时,我试图阻止页面刷新。我试过了,但它不起作用:
更新:
<h:dataTable value="#{person.IssueList}" var="p" >
<h:column style="width: 20px">
<f:facet name="header">Issue</f:facet>
<h:commandLink value="#{p.IssueDesc}"/>
</h:column>
<h:column style="width: 20px">
<f:facet name="header">Reporting Date</f:facet>
<p:calendar value="#{p.issuerepDt}" rendered="#{p.editable}" id="CalendarId"/>
<h:outputText value="#{p.issuerepDt}" rendered="#{not p.editable}" />
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<h:commandLink value="Edit" action="#{person.editAction(p)}">
<f:ajax execute="@form" render="@none" />
</h:commandLink>
</h:column>
</h:dataTable>
java sn-p:
public void editAction(PersonIssues pIssues) {
pIssues.setEditable(true);
}
我正在使用来自 MKyong.I 的editing jsf datatable 的概念
【问题讨论】:
-
你确定它是
Person.而不是person.,试着让你的edtiAction方法无效... -
感谢您注意到错字。您只是希望我将操作返回类型更改为无效,并对上面发布的代码进行任何更改?
-
是的,试试看,
public void edtiAction(){};否则会是隐式导航 -
这应该可以正常工作。我相信您的具体问题/问题措辞不佳。您已经通过嵌入
<f:ajax>完成了防止页面刷新的工作。它现在不再刷新了,对吧?我猜您的 实际 问题是当您单击链接时输出文本没有更改为日历,并且您无法弄清楚如何执行此操作,对吗? -
@BalusC .....是的,这正是我的问题。抱歉,如有任何困惑。请给我建议解决方案。我通过查看您的其他答案实现了上述内容。stackoverflow.com/questions/8988780/…跨度>
标签: java html ajax jsf page-refresh