0
我遇到了更新组件上的菜单项的一些奇怪行为。我的样品JSF页面看起来如下:Primefaces:在更新后,Menuitem(或按钮)在Internet Explorer中不起作用
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head/>
<h:body>
<h:form id="form">
<p:menubar id="menubar" widgetVar="menubar">
<p:menuitem value="Select me" onclick="alert('Menu item selected')"/>
</p:menubar>
<p:commandButton value="Update menubar" update="menubar"/>
</h:form>
</h:body>
</html>
当我在Internet Explorer 11运行此并点击“更新菜单栏”菜单项不再起作用,即不显示警报,并在网址地址栏从..../test.xhtml更改为..../test.xhtml#。
当我在Firefox上运行时,一切都很好,即使通过单击按钮更新菜单栏后,菜单项仍会显示警报。
此行为是否为IE错误?还是应该这样工作? IE浏览器行为有没有解决方法?
编辑:
有问题的样品可以进一步减少;同样的问题出现在只包含两个按钮的形式,以一个更新等,使其停止工作在IE:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head/>
<h:body>
<h:form id="form">
<p:commandButton value="Click me" onclick="alert('Button clicked')"
id="button" widgetVar="button"/>
<p:commandButton value="Update button" update="button"/>
</h:form>
</h:body>
</html>