【发布时间】:2016-01-19 19:07:26
【问题描述】:
我正在尝试在 a4j:commandButton 的 oncomplete 刚刚完成时从 html 链接调用一次点击 (id=btnPreview1),但是,firefox(其他浏览器很好)正在启动 NS_ERROR_FAILURE:。在 google 上搜索其他情况,发现这可能是 XSS 验证错误。我该如何解决?
P.S 对不起,我的英语水平很差
<h:html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<h:head>
<script type="text/javascript">
function exec(data){
if(data.status=='success'){
//alert(data.status + " " + $("btnPreview1"));
//$("btnPreview1").submit();
document.getElementById("btnPreview1").click();
}
}
</script>
</h:head>
<h:body>
<h:form id="formZica" prependId="false">
<h:panelGrid id="page" columns="1">
<rich:panel id="panelParametros">
<f:facet name="header">
<h:panelGrid columns="1">
<h:outputText styleClass="subTitulo" value="Parâmetros" />
</h:panelGrid>
</f:facet>
<h:outputText value="Test field" />
<h:inputText id="field" required="true" />
<h:message for="field" />
<h:outputText value="#{facesContext.validationFailed}" />
</rich:panel>
<br />
<br />
<h:panelGroup>
<a4j:commandButton id="btnPreview" value="View"
oncomplete="if (#{not facesContext.validationFailed}) { document.getElementById('btnPreview1').click();};"
render="panelParametros" />
<h:commandButton id="btnPreviewNwe" value="View version with f:ajax" >
<f:ajax render="panelParametros" execute="@form" onevent="exec"/>
</h:commandButton>
<h:commandLink target="_blank" id="btnPreview1"
value="testeff" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</h:body>
</h:html>
富脸 4.3.2 jsf 2.1.26 (mojarra) FF 43.0.4
tks,
韦斯利
【问题讨论】: