"medjbpm" wrote : my userBean.java:
  | 
  | /*
  |  * JBoss, Home of Professional Open Source
  |  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  |  * by the @authors tag. See the copyright.txt in the distribution for a
  |  * full listing of individual contributors.
  |  *
  |  * This is free software; you can redistribute it and/or modify it
  |  * under the terms of the GNU Lesser General Public License as
  |  * published by the Free Software Foundation; either version 2.1 of
  |  * the License, or (at your option) any later version.
  |  *
  |  * This software is distributed in the hope that it will be useful,
  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  |  * Lesser General Public License for more details.
  |  *
  |  * You should have received a copy of the GNU Lesser General Public
  |  * License along with this software; if not, write to the Free
  |  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  |  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  |  */
  | package org.jbpm.webapp.bean;
  | 
  | /*import java.sql.Connection;
  | import java.sql.ResultSet;
  | import java.sql.SQLException;
  | import java.sql.Statement;*/
  | import java.util.ArrayList;
  | import java.util.Iterator;
  | import java.util.List;
  | 
  | import javax.faces.model.SelectItem;
  | 
  | //import org.hibernate.Query;
  | import org.hibernate.Session;
  | import org.jbpm.JbpmContext;
  | 
  | //import org.jbpm.db.JbpmSession;
  | import org.jbpm.identity.User;
  | import org.jbpm.identity.hibernate.IdentitySession;
  | 
  | public class UserBean {
  | 
  |   String userName;
  |   String pwd;
  |      
  |   public String getUserName() {
  |     return userName;
  |   }
  | 
  |   public void setUserName(String name) {
  |     this.userName = name;
  |   }
  |   
  |   public String getPwd() {
  |         return pwd;
  |       }
  |   
  |   public void setPwd(String pwd) {
  |         this.pwd= pwd;
  |       }
  |   
  |  /* public String login() {
  |     JbpmContext.getCurrentJbpmContext().setActorId(userName);
  |     return "home";
  |   }*/
  |   
  |   
  |  public String login() {
  |       
  |       Session session = JbpmContext.getCurrentJbpmContext().getSession();
  |       IdentitySession identitySession = new IdentitySession(session);
  |       Object found =identitySession.verify(userName,pwd);
  |         
  |         System.out.print("" + userName) ;
  |         
  |         if(found != null && userName.compareTo("Agent_Acceuil")==0) {
  |             System.out.print("1") ;
  |             JbpmContext.getCurrentJbpmContext().setActorId(userName);
  |              return "home";
  |                 }   
  |        else if(found!=null && userName.compareTo("Agent_Acceuil")!=0) {
  |             System.out.print("2") ;
  |             JbpmContext.getCurrentJbpmContext().setActorId(userName);
  |                 return "homeresp";                  
  |         }
  |         else
  |             return "login";
  |         
  |         
  |   }
  |   
  |  public List getUsers() {
  |     Session session = JbpmContext.getCurrentJbpmContext().getSession();
  |     IdentitySession identitySession = new IdentitySession(session);
  |     return identitySession.getUsers();
  |   }
  | 
  |   public List getUserSelectItems() {
  |     List userSelectItems = new ArrayList();
  | 
  |     Iterator iter = getUsers().iterator();
  |     
  |     while (iter.hasNext()) {
  |       User user = (User) iter.next();
  |       userSelectItems.add(new UserSelectItem(user));
  |     }
  |     
  |     return userSelectItems;
  |   }
  |   
  |   public static class UserSelectItem extends SelectItem {
  |     private static final long serialVersionUID = 1L;
  |     public UserSelectItem(User user) {
  |       setValue(user.getName());
  |       setLabel(user.getName());
  |             
  |     }
  |   }
  | 
  | }
  | 
  | 
  | My login.jsp
  | 
  | <%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
  | <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
  | <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
  | 
  | <f:view>
  | <jsp:include page="Bienvenu.jsp" />
  | 
  | 
  | <h:messages/>
  | 
  | 
  | 
  | Identification
  | 
  | <h:form id="login" >
  |   
  |   <!-- Login &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp      :
  |   <h:selectOneMenu id="username" required="true" 
value="#{userBean.userName}">
  |     <f:selectItems value="#{userBean.userSelectItems}" />
  |   </h:selectOneMenu> 
  |     -->
  |     Login                : 
  |   <h:inputText id="userName" value="#{userBean.userName}"/> 
  |   
  |   Mot de Passe : <h:inputSecret  id="pwd"  value="#{userBean.pwd}"/>
  |    
  |   
  |   <h:commandButton action="#{userBean.login}" value="Connection" />
  |   
  | </h:form> 
  | 
  | 
  | 
  | 
  | 
  | <jsp:include page="footer.jsp" />
  | </f:view>
  | 
  | 
  | i get the following error
  | 
  | 
  | .Erreur de validation
  | 
  | 
  | Can any one give me help
  | thanks
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3941860#3941860

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3941860


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to