I am trying to use Icefaces login with Spring security. For some reason I am not able to successfully login to my application. It always gives incorrect username or password even though I am using providing correct authentication details. I am using Icefaces 1.8.2 and JSF 1.1.
Could some one provide some help as why I am not able to login successfully in spite of providing correct authentication details.
I am following the example here
My login.jspx
<?xml version="1.0" encoding="ISO-8859-1" ?>
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<ice:outputDeclaration doctypeRoot="HTML"
doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
doctypeSystem="http://www.w3.org/TR/html4/loose.dtd"/>
<html>
<head>
<title>Spring Security Login</title>
</head>
<body>
<ice:form partialSubmit="false">
<ice:panelGrid columns="2">
<ice:outputLabel value="User Name" for="j_username"/>
<ice:inputText id="j_username"
value="#{loginBean.userId}" size="40"
maxlength="80"/>
<ice:outputLabel value="Password" for="j_password"/>
<ice:inputSecret id="j_password"
value="#{loginBean.password}" size="40"
maxlength="80"/>
</ice:panelGrid>
<ice:commandButton actionListener="#{loginBean.login}" value="Login"/>
<ice:messages style="color: red;"/>
</ice:form>
</body>
</html>
</f:view>
And my loginBean login method
public void login(ActionEvent e) throws java.io.IOException {
HttpServletRequest req =
(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
FacesContext.getCurrentInstance().getExternalContext().redirect(req.getContextPath().toString() +
"/j_spring_security_check?j_username=" +
userId + "&j_password=" +
password);
}
Ok I managed to get it working using plain old jsp, not jsf and form action method must be POST
my login.jsp
<form action="j_spring_security_check" method="POST">
<label for="j_username">Username</label>
<input type="text" name="j_username" id="j_username"/><br/>
<label for="j_password">Password</label>
<input type="password" name="j_password" id="j_password"/><br/>
<input type="submit" value="Login"/>
</form>