如何在JSF 2.0页面上将参数传递给javascript函数

问题描述

| 我正在制作一个自定义登录对话框,类似于在http://www.primefaces.org/showcase/ui/dialogLogin.jsf上找到的对话框,但是在构建时出现错误:   javax.el.PropertyNotFoundException:/WEB-INF/templates/BasicTemplate.xhtml @ 58,83 oncomplete = \“ handleLoginRequest(#{securityController.logIn})\”:类\'managedbeans.SecurityController \'没有该属性\'登录\'。 我认为错误在于我尝试触发日志记录过程的方式。有人可以看看我的语法是否正确吗?
  <p:dialog id=\"dialog\" header=\"Login\" widgetVar=\"dlg\" modal=\"true\" width=\"400\" resizable=\"false\" draggable=\"false\" fixedCenter=\"true\">  
<h:form>    
    <h:panelGrid columns=\"2\" cellpadding=\"5\">  
        <h:outputLabel for=\"username\" value=\"Em@il: *\" />  
        <p:inputText value=\"#{securityController.email}\"   
                id=\"email\" required=\"true\" label=\"email\" />  

        <h:outputLabel for=\"password\" value=\"Password: * \" />  
        <h:inputSecret value=\"#{securityController.password}\"   
                id=\"password\" required=\"true\" label=\"password\" />  

        <f:facet name=\"footer\">  
            <p:commandButton value=\"Login\" update=\"growl\"                       
                oncomplete=\"handleLoginRequest(#{securityController.logIn})\"/>  
        </f:facet>  
    </h:panelGrid>           
</h:form>  
</p:dialog> 
<script type=\"text/javascript\">  
function handleLoginRequest(input) {  
    if(input == false) {  
        jQuery(\'#dialog\').parent().effect(\"shake\",{ times:3 },100);  
    } else {  
        dlg.hide();  
        jQuery(\'#loginLink\').fadeOut();  
    }  
 }  
</script> 
这是托管bean,它保存了被称为onComplete事件的方法:
@ManagedBean
@RequestScoped
public class SecurityController {

@EJB
private IAuthentificationEJB authentificationEJB;
private String email;
private String password;
private String notificationValue;   

public void logIn() {
    if(authentificationEJB.saveUserState(email,password)) {
        notificationValue = \"Dobro dosli\";
    }   
}
    //getters and setters...
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)