JSF selectCheckBoxMenu在IE中无法正常工作 [英] JSF selectCheckBoxMenu not working properly in IE

查看:101
本文介绍了JSF selectCheckBoxMenu在IE中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jsf应用程序在IE上运行时遇到问题.

I am facing an issue with my jsf application while running it on IE.

jsf上的selectcheckboxmenu出现故障,并且菜单项的复选框移动到了菜单项的下方,这些复选框仍然存在.以下是我所面临的屏幕截图:

The selectcheckboxmenu on jsf behaves faulty and has the checkboxes of the menu items shifted below the items, The checkboxes are still there. Below is the screenshot of what i am facing :

[IMG] http://i43.tinypic.com/8yb976.jpg[/IMG]

selectcheckbox菜单的代码如下:

the code for the selectcheckboxmenu is given below :

<p:selectCheckboxMenu value="#{formBean.selectedMovies}" label="Movies"
    filter="true" filterText="Filter" filterMatchMode="startsWith"
    panelStyle="width:220px">
    <f:selectItems value="#{formBean.movies}" />
</p:selectCheckboxMenu>

请告诉我我要去哪里错了,这是什么问题. 预先感谢.

Please kindly tell me where am I going wrong and what is the problem. Thanks in advance.

推荐答案

IE有兼容性问题. Primefaces在IE9兼容性上运行良好. 并且您的复选框由于这个原因而无法正常工作.

There is compatibility problem with IE. Primefaces runs good on IE9 compatibility. And your check box is not working beacause of this.

我经历了同样的问题.因此,您必须使用jsf的生命周期设置兼容性"视图

I had gone through the same issues. So you have to set the Compatibility view by using the life cycle of jsf

public class UACompatibleHeaderPhaseListener implements PhaseListener {
@Override
public void afterPhase(PhaseEvent arg0){}

@Override
public void beforePhase(PhaseEvent event){
    final FacesContext facesContext = event.getFacesContext();
    final HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
    response.addHeader("X-UA-Compatible", "IE=edge");
}

@Override
public PhaseId getPhaseId() {
     return PhaseId.RENDER_RESPONSE;
}
}

然后在您的Faces-config.xml中,将具有包名称的类放入

And in your Faces-config.xml just place the class with the packagename

<lifecycle>
   <phase-listener>
     com.jsf.listener.UACompatibleHeaderPhaseListener
   </phase-listener>
</lifecycle>

这篇关于JSF selectCheckBoxMenu在IE中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆