I have been trying to create a login screen for an application that was created 
with the reverse engineering tool. With the help of those created files and the 
login files of the seam-booking example, I created the following files (see 
below).
However, when I run the application and hit the login button, nothing happens, 
instead, next to the inputs, an error message is shown:
"login_userName": Error during model data update.   
"login_password": Error during model data update.

There are no error messages in the server log. 

any ideas what we are doing wrong? do we need to edit any other configuration 
files in the project? it is driving us crazy and any help would  greatly been 
appreciated.        

login.jsp
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
  | <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
  | <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  |  <f:view>
  |  <f:loadBundle basename="messages" var="msg"/>
  |   <head>
  |    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" 
/>
  |    <title>Login screen</title>
  |    <style type="text/css" media="all">
  |     @import "style/default/screen.css";
  |    </style>
  |   </head>
  |   <body>
  |    <h:form>
  |    
  |      <h1>
  |          <h:outputText value="Login" />
  |      </h1>
  |      
  |      <div class="rvgSwitch">
  |        <h:selectOneMenu value="#{switcher.conversationIdOrOutcome}">
  |          <f:selectItem itemLabel="Create Employee" 
itemValue="editEmployee"/>
  |          <f:selectItem itemLabel="Create Worksin" itemValue="editWorksin"/>
  |          <f:selectItem itemLabel="Create Activitytype" 
itemValue="editActivitytype"/>
  |          <f:selectItem itemLabel="Create Project" itemValue="editProject"/>
  |          <f:selectItem itemLabel="Create Activity" 
itemValue="editActivity"/>
  |          <f:selectItem itemLabel="Find Employee" itemValue="findEmployee"/>
  |          <f:selectItem itemLabel="Find Worksin" itemValue="findWorksin"/>
  |          <f:selectItem itemLabel="Find Activitytype" 
itemValue="findActivitytype"/>
  |          <f:selectItem itemLabel="Find Project" itemValue="findProject"/>
  |          <f:selectItem itemLabel="Find Activity" itemValue="findActivity"/>
  |          <f:selectItems value="#{switcher.selectItems}"/>
  |        </h:selectOneMenu>
  |        <h:commandButton action="#{switcher.select}" value="Switch"/>
  |      </div>
  |     
  |      <div class="rvgFind">
  |      <fieldset class="rvgFieldSet">
  |        <legend><h:outputText value="Login details"/></legend>
  |        
  |        <span class="rvgInputs">
  |          <span class="rvgMessage"><h:messages globalOnly="true"/></span>
  |          <h:outputLabel value="Username" for="login_userName">
  |            <h:inputText value="#{employee.userName}" id="login_userName" />
  |            <span class="rvgMessage"><h:message for="login_userName"/></span>
  |          </h:outputLabel>
  |          <h:outputLabel value="Password" for="login_password">
  |            <h:inputText value="#{employee.password}" id="login_password" />
  |            <span class="rvgMessage"><h:message for="login_password"/></span>
  |          </h:outputLabel>
  |        </span>
  | 
  |        <span class="rvgActions">
  |          <h:commandButton type="submit" value="Login" 
action="#{login.login}" />
  |        </span>
  |      
  |      </fieldset>
  |      </div>
  |     
  |    </h:form>
  | 
  |   </body>
  |  </f:view>
  | </html>

LoginAction.java
//$Id: LoginAction.java,v 1.10 2006/01/04 16:01:34 gavin Exp $
  | package something;
  | 
  | import java.util.List;
  | 
  | import javax.ejb.Stateful;
  | import javax.ejb.Interceptors;
  | import javax.ejb.Stateless;
  | import javax.faces.application.FacesMessage;
  | import javax.faces.context.FacesContext;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | import org.hibernate.validator.Valid;
  | 
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.contexts.Context;
  | import org.jboss.seam.ejb.SeamInterceptor;
  | 
  | @Name("login")
  | @Stateful
  | @Interceptors(SeamInterceptor.class)
  | public class LoginAction implements Login
  | {
  |    
  |    @In @Out
  |    private Employee employee;
  |     
  |    @PersistenceContext
  |    private EntityManager em;
  |    
  |    @In(create=true)
  |    private transient Context sessionContext;
  |    // @In
  |    // private transient FacesContext facesContext;
  |    
  |    public String login()
  |    {
  |       List<Employee> results = em.createQuery("from Employee where 
userName=:userName and password=:password")
  |             .setParameter("userName", employee.getUserName())
  |             .setParameter("password", employee.getPassword())
  |             .getResultList();
  |       
  |       if ( results.size()==0 )
  |       {
  |              FacesContext.getCurrentInstance().addMessage(null, new 
FacesMessage("Invalid login"));
  |          return "main";
  |       }
  |       else
  |       {
  |          employee = results.get(0);
  |          sessionContext.set("loggedIn", true);         
  |          return "main";
  |       }
  |       
  |    }
  | 
  | }

login.java:
//$Id: Login.java,v 1.1 2005/08/19 03:33:15 gavin Exp $
  | package something;
  | 
  | import javax.ejb.Local;
  | 
  | @Local
  | public interface Login
  | {
  |    public String login();
  | }

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to