Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf PrimeFaces远程命令未调用_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf PrimeFaces远程命令未调用

Jsf PrimeFaces远程命令未调用,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我使用一个远程命令按钮来执行一个bean级别的方法。但我的命令按钮不起作用 我在下面附上我的代码: <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:p="http:/

我使用一个远程命令按钮来执行一个bean级别的方法。但我的命令按钮不起作用

我在下面附上我的代码:

 <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:p="http://primefaces.org/ui">

<ui:composition template="/layouts/BasicTemplate.xhtml">
    <ui:define name="content">
        <div class="container">

        <script>

        function doAlert(s)
        {
            if(s=="true")
                {
                alert(s);
                rc();
                alert('hi i am');
                }
            else
                {
                 alert("Wrong Finger Print");
                }
        }

        </script>


          <h:form class="form-horizontal" id="myform" >
                <div class="row">

        <h:messages />
        <h:panelGrid columns="3" cellpadding="4" border="0" columnClasses="control-label">

            <h:outputText  value="Username :" />
            <h:inputText id="username" value="#{loginBean.login}" label="username" style="width: 200;" /> 
            <p:watermark for="username" value="Username" ></p:watermark>

            <h:outputLabel for="password" value="Password :" />
            <h:inputSecret id="password" value="#{loginBean.password}" label="password" style="width: 200;"/> 
            <p:watermark for="password" value="Password"></p:watermark>

            <p:spacer></p:spacer>
            <!-- <p:commandButton value="Login" action="#{loginBean.logMeIn}" widgetVar="mybutton" /> -->

            <p:commandButton id="loginButton" value="Login" action="#{loginBean.logMeIn}" widgetVar="mybutton"  disabled="#{!loginBean.enabled}"/>
            <p:remoteCommand name="rc" update="loginButton" actionListener="#{loginBean.enableButton}" /> 
            <p:spacer></p:spacer>
            <h:outputText value="#{loginBean.enabled}"></h:outputText>
            <applet id="fingureprintapplet" name="fingureprint" codebase="classes"  code="fingerprintntscanner.MyClassApplet.class" archive="#{facesContext.externalContext.requestContextPath}/FIngerprintntScanner.jar,#{facesContext.externalContext.requestContextPath}/lib/NBioBSPJNI.jar" width="300" height="400">

            </applet>
        </h:panelGrid>

        </div>
        </h:form>

        </div>
    </ui:define>
</ui:composition>

请检查我的远程命令不起作用的原因。

remoteCommand
上使用
process=“@this”
partialSubmit=“true”

究竟什么是“不起作用”?您甚至没有在代码中的任何地方调用
doAlert
。那么您希望发生什么呢?另外,如果您的bean名称可能错误,方法名称/签名可能错误(因此请将一个最小但完全有效的bean发布到),您可能有嵌套表单(来自模板),那么请创建一个简化的示例…@user1983983我正在调用rc();在我的doAlert方法和doAlertMethod中applet@Kukeltje我正在更新我的问题。请检查更新是否如预期那样发出警报,但未记录值为且按钮未更新?
     @ManagedBean(name = "loginBean")
@SessionScoped
public class LoginBean implements Serializable {
    private static final long serialVersionUID = 1L;

    private String login;
    private String password;
    private boolean enabled;

    @ManagedProperty(value = "#{authenticationService}")
    private AuthenticationService authenticationService; // injected Spring defined service for bikes


    public String logMeIn() {

        boolean success = authenticationService.login(login, password);

        if (success){
            return "/faces/pages/home.xhtml?faces-redirect=true"; // return to application but being logged now 
        }
        else{
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Login or password incorrect."));           
            return "/faces/login.xhtml";
        }
    }

    public String logout(){
        System.out.println("chandan");
        authenticationService.logout();
        return "/faces/pages/home.xhtml?faces-redirect=true"; 
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }



    public void setAuthenticationService(AuthenticationService authenticationService) {
        this.authenticationService = authenticationService;
    }

    public void enableButton() {
        System.out.println("chandan");
        enabled = true;
    }

    public boolean isEnabled(){
        System.out.println("value is");
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        System.out.println("value is sdgsdg");
        this.enabled = enabled;
    }