这是我的阶段监听器
public class AdminPhaseListener implements PhaseListener {
private static final long serialVersionUID = -1161541721597667238L;
public void afterPhase(PhaseEvent e) {
System.out.println("after Phase " + e.getPhaseId());
}
public void beforePhase(PhaseEvent e) {
System.out.println("before Phase " + e.getPhaseId());
if(e.getPhaseId()== PhaseId.RESTORE_VIEW)
{
}
}
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
}
Run Code Online (Sandbox Code Playgroud)
单击我页面中的命令按钮,我调用一个动作方法并进行一些处理,但是根本没有调用动作方法,但是在服务器日志中,我可以看到我的PhaseListener为所有阶段打印的消息.
如果我的视图没有改变,它会在RESTORE_VIEW阶段之后停止吗?
有什么想法吗?
添加如何显示命令按钮的代码:
<table width="100%">
<h:column rendered="#{adminBean.displayResultsSize > 0}">
<tr>
<td colspan="14" height="5" nowrap="nowrap" class="WhiteRow"></td>
</tr>
<tr>
<td colspan="14" height="1" nowrap="nowrap" align="center"
bgcolor="#999999"></td>
</tr>
<h:inputHidden id="removeUserId" value="#{adminBean.removeUserId}"/>
<h:inputHidden id="removeIBD" value="#{adminBean.removeIBD}"/>
<h:inputHidden id="removeAPA" value="#{adminBean.removeAPA}"/>
<tr>
<td colspan="14" height="30" nowrap="nowrap"
class="FilterColumnGrayHeader" align="center">
<input type="button" disabled="disabled" id="button_edit"
value="Edit Details" class="disabledfield"
onclick="populateEditRow();">
</input> <h:commandButton type="submit" class="disabledfield" immediate="true"
id="button_remove" value="Remove" onclick="populateRemoveRow();" action="#{adminBean.remove}">
</h:commandButton>  
</td>
</tr>
<tr bgcolor="#000000">
<td colspan="14" height="1" nowrap="nowrap" align="center"
bgcolor="#999999"></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</h:column>
</table>
Run Code Online (Sandbox Code Playgroud)
Bal*_*usC 35
我引用这个答案:
只要
UICommand组件无法调用关联的操作,请验证以下内容:
UICommand组件必须放在UIForm组件内(例如h:form).- 您不能将多个组件嵌套
UIForm在一起(注意包含文件!).- 不应该发生验证/转换错误(用于
h:messages获取所有错误).- 如果
UICommand部件被放置在内部UIData部件中,确保完全一样的DataModel(在后面的对象UIData的value属性)被保留.- 的
rendered和disabled组件的属性,并且父组件的所有不应该求false期间应用请求值阶段.- 确保请求 - 响应链中没有
PhaseListener或任何EventListener已更改JSF生命周期以跳过调用操作阶段.- 确保没有
Filter或Servlet在同一个请求 - 响应链中FacesServlet以某种方式阻止了请求.
另一个原因可能是您没有运行您认为正在运行的代码.
| 归档时间: |
|
| 查看次数: |
27325 次 |
| 最近记录: |