Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 2.13 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Login not working using Spring Security in Icefaces
  2. <?xml version="1.0" encoding="ISO-8859-1" ?>
  3. <f:view xmlns:f="http://java.sun.com/jsf/core"
  4.         xmlns:h="http://java.sun.com/jsf/html"
  5.         xmlns:ice="http://www.icesoft.com/icefaces/component">
  6.     <ice:outputDeclaration doctypeRoot="HTML"
  7.                            doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
  8.                            doctypeSystem="http://www.w3.org/TR/html4/loose.dtd"/>
  9.     <html>
  10.     <head>
  11.         <title>Spring Security Login</title>
  12.     </head>
  13.     <body>
  14.     <ice:form partialSubmit="false">
  15.         <ice:panelGrid columns="2">
  16.             <ice:outputLabel value="User Name" for="j_username"/>
  17.             <ice:inputText id="j_username"
  18.                            value="#{loginBean.userId}" size="40"
  19.                            maxlength="80"/>
  20.             <ice:outputLabel value="Password" for="j_password"/>
  21.             <ice:inputSecret id="j_password"
  22.                              value="#{loginBean.password}" size="40"
  23.                              maxlength="80"/>
  24.         </ice:panelGrid>
  25.         <ice:commandButton actionListener="#{loginBean.login}" value="Login"/>
  26.         <ice:messages style="color: red;"/>
  27.     </ice:form>
  28.     </body>
  29.     </html>
  30. </f:view>
  31.        
  32. public void login(ActionEvent e) throws java.io.IOException {
  33. HttpServletRequest req =
  34. (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
  35.        FacesContext.getCurrentInstance().getExternalContext().redirect(req.getContextPath().toString() +
  36.                                                                     "/j_spring_security_check?j_username=" +
  37.                                                                     userId + "&j_password=" +
  38.                                                                     password);
  39.  
  40.  
  41. }
  42.        
  43. <form action="j_spring_security_check" method="POST">
  44.     <label for="j_username">Username</label>
  45. <input type="text" name="j_username" id="j_username"/><br/>
  46.     <label for="j_password">Password</label>
  47. <input type="password" name="j_password" id="j_password"/><br/>        
  48.     <input type="submit" value="Login"/>  
  49. </form>