【发布时间】:2011-08-04 13:40:50
【问题描述】:
我正在制作一个自定义登录对话框,类似于在 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...
【问题讨论】:
-
您可以将参数而不是方法传递给javascript
标签: java javascript jakarta-ee jsf-2 primefaces