![](/img/trans.png)
[英]I don't know why the "while" loop is blocking my onClickListener
[英]My page is opening a new tab and I don't know why
我有一个网页,当输入日期正确时必须下载 XLS,但如果它们不正确,它必须显示一条消息并停止下载过程。
一切正常,当日期不正确时,我会建议用户,但每次单击按钮时它都会打开一个新选项卡。 如果日期正确,它会打开一个新选项卡,但在下载 XLS 时它会关闭,如果日期不正确,它会建议用户,但它会打开新选项卡但不会关闭它。 如何修复它而不打开新标签?
我把我的代码放在下面:
HTML:
<div class="botonera">
<a4j:commandLink id="regimenConcertadoLink"
styleClass="botonAplicacionTXT"
action="#{descargaInformesBean.validarInformeRegimenConcertado()}"
oncomplete="if(#{descargaInformesBean.informeRegimenConcertadoValido}){#{rich:element('descargaInforme')}.onclick();}"
status="waitStatus">
<h:outputText value="Descargar Informe" />
<h:graphicImage value="/img/ico_descargar.gif"
alt="Descargar Informe"
title="Descargar Informe" />
<f:param name="requiredValidator"
value="requiredValidator" />
</a4j:commandLink>
<h:commandLink id="descargaInforme"
styleClass="botonAplicacionTXT" target="_blank"
action="#{descargaInformesBean.descargarInformeIngresos()}">
</h:commandLink>
</div>
爪哇:
public void descargarInformeIngresos() throws ServiceException, IOException {
if ((filtroFechaDesde != null && filtroFechaHasta != null) || (filtroFechaIngresoDesde != null && filtroFechaIngresoHasta != null)) {
//DOXMLSTUFF
}else {
AtlasFacesUtils.addErrorMessageFromBundle("error.fecha.vacia");
}
}
正如您在代码中看到的,如果两个日期都为空,我不做任何事情并显示一条消息来建议用户,这工作正常,但仍然打开一个新选项卡,我不想这样做
谢谢!
我相信这是由于您使用的目标标签属性造成的。 这
target="_blank"
打开一个新标签
尝试将其更改为
target="_self"
看看它是否修复了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.