reset

on page load

前端 未结 2 1199
清歌不尽
清歌不尽 2021-01-29 04:04

How to reset on page load? Using JSF or onClick event of a CommandButton

Please post here an example either in Javascript or Ajax

Please some one help me for th

2条回答
  •  庸人自扰
    2021-01-29 04:47

    You can clear the value of the checkbox in the constructor.

    This is how your checkbox might look:

         
    

    When the checkbox is checked, value1 becomes true. In the constructor of the bean class, you make value1 false.

    You bean class:

        Class BeanClass
        {
    
            private boolean value1;
            public BeanClass()
            {
                value1 = false;
                //Someother statements might follow.
            }
    
            public boolean getValue1()
            {
                return value1;
            }
    
            public void setValue1(boolean value1)
            {
                this.value1 = value1;
            }
        }
    

    Notice that I have set the value of value1 to false in the constructor, which gets called on page load, thereby rendering false in the primeface tag. Hope this helps.

提交回复
热议问题