小编Kun*_*alC的帖子

仅显示带图像的命令按钮

我试图只在我的页面上显示一个带图像的按钮,但我看到的只是带有^的按钮.以下是我的按钮的代码:

<p:commandButton onclick="lineSearch.show();" image="backgroung-image:url(/images/title_logo.jpg)"/> 
<p:dialog header="Modal Dialog" widgetVar="lineSearch" modal="true" onCloseUpdate="lineIdField" showEffect="scale" hideEffect="explode">  
    <ui:include src="lineSearch.xhtml"/>
</p:dialog>
Run Code Online (Sandbox Code Playgroud)

图像确实存在于images文件夹中.该按钮在页面中呈现如下:

<button id="j_idt23:j_idt27" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" type="submit" onclick="lineSearch.show();;PrimeFaces.ab({formId:'j_idt23',source:'j_idt23:j_idt27',process:'@all'});return false;" name="j_idt23:j_idt27" role="button" aria-disabled="false">
    <span class="ui-button-icon-primary ui-icon backgroung-image:url(/images/title_logo.jpg)"></span>
    <span class="ui-button-text">ui-button</span>
</button>
<script type="text/javascript">
    widget_j_idt23_j_idt27 = new PrimeFaces.widget.CommandButton('j_idt23:j_idt27', {text:false,icons:{primary:'backgroung-image:url(/images/title_logo.jpg)'}});
</script>
Run Code Online (Sandbox Code Playgroud)

谢谢!!!

jsf primefaces jsf-2

16
推荐指数
1
解决办法
7万
查看次数

Primefaces:所有ajax请求的默认oncomplete方法

我正在尝试为所有ajax请求配置一个oncomplete方法,以便我可以处理会话超时.

我尝试添加以下脚本但它的工作方式与为p:ajax元素设置oncomplete属性的方式不同.每次发出Ajax请求时都不会执行.

$.ajaxSetup({method: post,
    complete: function(xhr, status, args){
        var xdoc = xhr.responseXML;
        if(xdoc == null){
            return;
        }
        errorNodes = xdoc.getElementsByTagName('error-name');

        if (errorNodes.length == 0) {
            return;
        }

        errorName = errorNodes[0].childNodes[0].nodeValue;
        errorValueNode = xmlDoc.getElementsByTagName('error-message');
        errorValue = errorValueNode[0].childNodes[0].nodeValue;

        alert(errorValue);
        document.location.href='${pageContext.request.contextPath}/login/login.jsf';
    }
});
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激

ajax jquery primefaces

4
推荐指数
2
解决办法
6444
查看次数

Bash在执行数值计算时退出

我试图在我的bash脚本中执行以下逻辑

#!/bin/bash
set -x
# Copy merchant files
set -o pipefail -o errexit

a=0
b=0
c=$(expr $a + $b)
if [[ $(expr $c) -lt 10 ]]; then
  echo true
fi
Run Code Online (Sandbox Code Playgroud)

这从未按预期打印.产生的输出是:

++ set -o pipefail -o errexit
++ a=0
++ b=0
+++ expr 0 + 0
++ c=0
Run Code Online (Sandbox Code Playgroud)

当a和b都为0时,上述逻辑也不起作用,如果任何一个非零,则它工作正常.如果我修改我的逻辑而不是计算c,直接使用expr如果它工作正常并按预期打印为true,而不管a和b的值如何

#!/bin/bash
set -x
# Copy merchant files
set -o pipefail -o errexit

a=0
b=0
if [[ $(expr $a + $b) -lt 10 ]]; then
  echo true
fi
Run Code Online (Sandbox Code Playgroud)

有人可以解释我第一段代码有什么问题.

bash shell sh

1
推荐指数
1
解决办法
98
查看次数

标签 统计

primefaces ×2

ajax ×1

bash ×1

jquery ×1

jsf ×1

jsf-2 ×1

sh ×1

shell ×1