我想提出一個自定義登錄對話框,類似於一個在http://www.primefaces.org/showcase/ui/dialogLogin.jsf發現卻得到一個錯誤,當建築:我如何將參數傳遞給JavaScript函數的JSF 2.0頁
javax.el。 PropertyNotFoundException:/WEB-INF/templates/BasicTemplate.xhtml @ 58,83 oncomplete =「handleLoginRequest(#{securityController.logIn})」:類'managedbeans.SecurityController'沒有屬性'logIn'。
我認爲錯誤在於我試圖觸發記錄程序。如果我的語法正確,有人可以看看嗎?
<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="[email protected]: *" />
<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>
而這一點,認爲被調用的onComplete事件的方法管理bean:
@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 – niksvp 2011-04-13 09:50:26