h:commandButton and s:button on login
adamo901 Jan 28, 2009 2:39 PMThis is how I coded login.xhtml
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <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:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib"> <head> </style> <title>Connexion</title> </head> <body> <rich:panel header="Connexion"> <rich:messages/> <h:form id="login"> <h:panelGrid columns="2"> <h:outputLabel for="username">username</h:outputLabel> <h:inputText id="username" value="#{credentials.username}"/> <h:outputLabel for="password">password</h:outputLabel> <h:inputSecret id="password" value="#{credentials.password}"/> <h:commandButton value="Login" action="#{identity.login}" /> <s:button value="SeamLogin" action="#{identity.login}" /> </h:panelGrid> </h:form> </rich:panel> </body> </html>
When I click on Login (using h:commandButton) every thing is ok:
If the user exist : I can login, if not, I get the message Login failed
When I click on SeamLogin, whenever the user exist or not, I always get the message Login failed.
I am using seam 2.1.1GA with glassfish 2.
my pagex.xml is :
<?xml version="1.0" encoding="UTF-8"?> <pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd" no-conversation-view-id="/home.xhtml" login-view-id="/login.xhtml"> <page view-id="/mypage.xhtml" login-required="true"> <restrict>#{s:hasRole('admin')}</restrict> </page> <navigation from-action="#{identity.login}"> <!--rule if-outcome="loggedIn"> <redirect view-id="/profile.xhtml"/> </rule--> <rule if="#{identity.loggedIn and authenticatedMember ne null}"> <redirect view-id="/home.xhtml"/> </rule> </navigation>