小编Dan*_*iel的帖子

仅在显示特定h:消息时显示JSF元素

我有一个h:form带有几个输入,每个都有自己的h:message,我正在寻找一种方法来显示(使用render或指定一些styleClass)只有在显示特定的时候一些其他元素h:message(并在h:message没有显示时隐藏).

这是一段代码片段

<li>
    <h:panelGroup id="current_password_wrapper">
        <p:password value="#{myBean.myCurrPass}" id="current_password" required="true"
            styleClass="required_field" />
    </h:panelGroup>
    <h:message for="current_password"/>
</li>
<li>
    <h:panelGroup id="new_password_wrapper">
        <p:password value="#{myBean.myNewPass}" id="new_password" required="true"/>
    </h:panelGroup>
    <h:message for="new_password"/>
    <h:commandLink value="my value"/>
</li>
Run Code Online (Sandbox Code Playgroud)

我想h:commandLink只在显示时才<h:message for="new_password"/>显示

到目前为止我找不到任何东西......

jsf-2

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

jsf target ="_ blank"无法使用primefaces命令按钮

尝试打开一个新选项卡以接受来自bean的生成的pdf文件.

使用h:commandbutton,没有使用p.commandbutton打开选项卡.

试图在p:commandbutton上放置onclick和oncomplete ="window.open('_ blank'),它会打开一个新选项卡,但它不会获得pdf并获得"找不到错误404".

使用primefaces-3.1

谢谢

  <?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:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">


    <h:head>
        <h:outputStylesheet library="base" name='jquery-ui-1.8.16.custom.css' />
    </h:head>
    <h:form target="_blank">
      <p:commandButton value="Run" action="#{bean.createReport}"  />
    </h:form>

    </html>
Run Code Online (Sandbox Code Playgroud)

primefaces jsf-2

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

插件"yadcf"无法使用数据表

我正在尝试使用带有数据表的"yadcf"过滤插件,并将"未捕获的TypeError:undefined不是函数"作为调用yadcf函数的错误.

我已经验证插件已加载,我不确定是什么问题.

以下是要加载的库:

<script type="text/javascript" charset="utf-8" src="/DataTables/media/js/jquery-1.10.2.js"></script>
<script type="text/javascript" charset="utf-8" src="/DataTables/jquery-ui-1.10.3/ui/jquery-ui.js"></script>

<script type="text/javascript" charset="utf-8" src="/DataTables-1.10.0/media/js/nightly2.js"></script>
<script type="text/javascript" charset="utf-8" src="/yadcf-0.7.4/jquery.dataTables.yadcf.js"></script>
Run Code Online (Sandbox Code Playgroud)

css文件:

<style type="text/css" title="currentStyle">
    @import "/DataTables/media/css/demo_table.css";
    @import "/yadcf-0.7.4/jquery.dataTables.yadcf.css";
    @import "/DataTables/examples/examples_support/themes/ui-lightness/jquery-ui-1.8.4.custom.css";

</style>
Run Code Online (Sandbox Code Playgroud)

数据表:

oTable = $('#FE_Time_Table').DataTable( {
   "ajax":{"url": 'FE_Data.php', "dataSrc":'data'},
   "jQueryUI": true,  //Allow use of jquery-ui plug-in for themes
   "dom": 'W<"H"frCi>tS<"">', //Settings for where all the options appear on the page

   "columns": [
        { "name": "plate_no", "data": "plate_no", "className": "center_text" },
        { "name": "job_no", "data": "job_no", "className": "center_text" },
        { "name": "customer", …
Run Code Online (Sandbox Code Playgroud)

datatables yadcf

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

在客户端状态保存的情况下防止JSF2中的CSRF

我正在使用MyFaces 2.2.3与客户端状态保存+ PrimeFaces

在询问如何阻止BalusC告诉在不同会话中重用ViewState之后,我可以通过覆盖渲染器来注入我自己的CSRF令牌,让值为CSRF令牌,

我正在寻找一个不会强迫我修改我的xhtml页面的解决方案:)


BalusC提出了一种通过扩展来防止CSRF攻击的更好方法ViewHandlerWrapper,并且它工作得很好,我只需要通过restoreView以下方式修改一下

public UIViewRoot restoreView(FacesContext context, String viewId) {
    UIViewRoot view = super.restoreView(context, viewId);
    if (getCsrfToken(context).equals(view.getAttributes().get(CSRF_TOKEN_KEY))) {
        return view;
    } else {
        HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
        if (session != null) {
            session.invalidate(); //invalidate session so (my custom and unrelated) PhaseListener will notice that its a bad session now
        }
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("CSRF detected and blocked"); //better looking …
Run Code Online (Sandbox Code Playgroud)

viewstate myfaces csrf jsf-2 jsf-2.2

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

设备所有者 QR 停止在 Android12 设备上工作,收到“无法设置设备”消息

由于某种原因,用于以设备所有者身份安装我们的应用程序的二维码在 Android12 设备上停止运行(相同的二维码在以前的 Android 版本上完美运行)。

我们收到的错误消息是:

Can't set up device
Contact your IT admin for help
Run Code Online (Sandbox Code Playgroud)

这是二维码的 JSON

{
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://someurlthatworkforsure",
  "android.app.extra.PROVISIONING_SKIP_ENCRYPTION": true,
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM": "validCheckSumThatWasTestedAndDoesWorkOnAndroidPriodTo12",
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.brand.name/com.brand.some.SomeClass"
}
Run Code Online (Sandbox Code Playgroud)

我进行了一些谷歌搜索,但没有发现我们的二维码有什么问题,

我也尝试将 PROVISIONING_SKIP_ENCRYPTION 设置为 false 并将其删除,结果是相同的。

CHECKSUM 是有效的,如果我弄乱它会引发不同的错误......

提前致谢。

android device-policy-manager device-owner android-12

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

如何设置仅显示月份和年份的日期选择器的日期

我正在尝试显示一个只显示月份+年份菜单的日期选择器,就像在这个Q'jquery日期选择器中仅显示月份一样,这不是问题,但我遇到了以下问题

我希望输入文本加载日期的字符串值,如01/2011,我希望在focusin事件上,datepicker将加载显示日期,我的意思是我希望它与2011年和月01已经打开选择

但由于某些原因,当我点击文本输入时,原始日期"01/2011"变为"01/01/2011"

这是我的代码

            $(document).delegate("#timeSpanFrom, #timeSpanTo", "focusin", function() {
            var $this = $(this);
            var inputDate = $.datepicker.parseDate('dd/mm/yy', "01/"+$this.val());
            if (!$this.data('datepicker_enabled')) {
                $this.datepicker({
                    changeMonth : true,
                    changeYear : true,
                    showButtonPanel : true,
                    onClose : function(dateText, inst) {
                        var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                        var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                        $(this).datepicker('setDate', new Date(year, month, 1));
                        $(".ui-datepicker-calendar").hide();
                    }
                });
                $this.datepicker({ dateFormat: 'mm/yy' }); 
                $this.datepicker('setDate', inputDate);
                $this.data('datepicker_enabled',true);
            }
        }); 

        $(document).delegate("#timeSpanFrom, #timeSpanTo", "focus", function() {
            $(".ui-datepicker-calendar").hide();
        });     
Run Code Online (Sandbox Code Playgroud)

谢谢你

jquery jquery-ui datepicker

3
推荐指数
1
解决办法
2万
查看次数

如何在primefaces日历中禁用键盘输入

如何在primefaces日历中禁用键盘输入?

这是我的代码:

<p:calendar id="regDate"  value="#{pc_Program.pendingRep.regDate}" 

pattern="dd/MM/yyyy" tabindex="3" navigator="true"

required="true" maxdate="a"                         

requiredMessage="Please Select Date Of Registration">                       

<p:ajax event="keyup" update="errcalender" />                       

<p:ajax event="dateSelect" update="errcalender" />                          

<p:ajax event="blur" update="errcalender"></p:ajax>                         

<p:ajax listener="#{pc_Program.addBtnEnble}"                            

update="addButton" /></p:calendar> 


<p:message id="errcalender" for="regDate" display="text"></p:message>
Run Code Online (Sandbox Code Playgroud)

primefaces jsf-2

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

ng-table,getData不止一次调用,为什么?

出于某种原因,当getData使用角度资源来调用数据时,它被调用两次,导致资源两次执行REST请求<--- bad ...

知道为什么以及如何解决它?

这里有一个重新创建这个场景的工作测试用例/ plunker示例(查看浏览器控制台 - "getData被调用...."显示两次)顺便说一下你可以看到我并没有真正使用该资源来提供真实数据,只是为了演示场景,在我的真实应用程序中,我确实使用该资源来提供真实数据,并将其调用两次,就像在此示例中一样,

谢谢你


在查看ng-table的src后,我注意到以下内容

$scope.$watch('params.$params', function(params) {
    $scope.params.settings().$scope = $scope;
    $scope.params.reload();
}, true);
Run Code Online (Sandbox Code Playgroud)

这意味着表调用它'getData',count/filter/group/groupBy/page/sorting 它解释了我所看到的行为.

angularjs ngtable

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

gRaphael Pie Chart:添加动画

我想要显示带有动画的饼图,这将使它从"小点"增长到全尺寸饼图,就像这个增长的馅饼或这个Highcharts Demo Gallery - Pie,但是我想把它应用到一个馅饼制作与gRaphael,

这是我的jsfiddle示例... 带有图例的raphael饼图

谢谢你,

raphael graphael

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

如何在使用<p:message>时自动隐藏/关闭错误消息?

我有这个规范,当显示错误消息(使用时<p:message>)由于验证消息或其他一些事情,它应该在一段时间后自动关闭.

我怎样才能做到这一点?

我正在使用primefaces

请给我一个解决方案

user-interface jsf primefaces

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

如果在Primefaces SelectOneMenu中未选择任何内容,如何禁用"提交"按钮

p:selectOneMenu的第一个元素是字符串'请选择',其他项目是要选择的列表.我可以在选择"请选择"时禁用提交按钮,如果选择了其他元素,是否启用按钮?我知道itemDisabled可以使用,但这不是我的要求.

<p:selectOneMenu value="#{bean.value}" id="selectId"
    filter="true" required="true" converter="itemConverter"
    filterMatchMode="contains" height="120">
    <f:selectItem itemLabel="Please select"/>
    <f:selectItems value="#{listBean.selectItemList}"></f:selectItems>
</p:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)

基本上,我希望在选择第一个项目时禁用提交按钮.

有人可以帮忙吗?

primefaces jsf-2

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

如何从调用函数控制isArray值?(修改$ resource params)

我想知道如何设置isArray参数resource,因为有时候我希望它true有时候false

这是我的资源工厂代码

dummyServices.factory('Dummy', ['$resource',
    function ($resource) {
        return $resource('http://dummyServer/dummyApp/dummyREST/:methodName', {}, {
            query: {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                isArray: false // <-- isArray: someParameter ???
            }
        });
    }]);
Run Code Online (Sandbox Code Playgroud)

我这样使用它:

$scope.myDummyObj = Dummy.query(
        {
            methodName: 'dummyMethod'
        },
        myDummyArgument
    );
Run Code Online (Sandbox Code Playgroud)

如何设置isArray从我的Dummy.query电话?

angularjs angular-resource

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