[jboss-user] [JBoss Seam] - Re: Could not instantiate Seam component/No object bound to
Echnaton
do-not-reply at jboss.com
Wed Jan 3 14:50:10 EST 2007
got cut off... well here is the rest
| /*
| * LocalLoginBean.java
| *
| * Created on 25. Dezember 2006, 21:40
| *
| * To change this template, choose Tools | Template Manager
| * and open the template in the editor.
| */
|
| package projektplaner;
|
| import javax.ejb.EJB;
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.core.FacesMessages;
| import org.jboss.seam.log.Log;
| import projektplaner.Exceptions.BenutzerExistiertnichtException;
|
| /**
| *
| * @author Echnaton
| */
| @Stateful
| @Name("lokaleinloggen")
| @Scope(ScopeType.SESSION)
| public class LokalEinloggenBean implements LokalEinloggenLocal
| {
| @In(create=true)
| private BenutzerBean benutzerbean;
|
| @In
| private FacesMessages facesMessages;
|
| @Logger
| private Log log;
|
| @Out(required=false)
| private Benutzer benutzer;
|
| private String benutzername;
| private String passwort;
|
|
| /** Creates a new instance of LocalLoginBean */
| public LokalEinloggenBean()
| {
| }
|
| public String einloggen()
| {
| try
| {
| if (loginVersuchGueltig())
| return getLoginErfolgreichCase();
| }
| catch (BenutzerExistiertnichtException e)
| {
| facesMessages.instance().add("Benutzer #{benutzer.benutzername} existiert nicht");
| }
|
| benutzer = null;
| return null;
| }
|
| private String getLoginErfolgreichCase()
| {
| return Konstanten.getERFOLGCASE();
| }
|
| private boolean loginVersuchGueltig() throws BenutzerExistiertnichtException
| {
| Benutzer einBenutzer = benutzerbean.getBenutzerNachBenutzername(benutzername);
|
| if (einBenutzer.getPasswort().compareTo(passwort) == 0)
| {
| benutzer = einBenutzer;
| return true;
| }
| else
| {
| facesMessages.add("Benutzer #{benutzer.benutzername} hat falsches Passwort eingegeben");
| return false;
| }
| }
|
| public String getBenutzername()
| {
| return benutzername;
| }
|
| public void setBenutzername(String benutzername)
| {
| this.benutzername = benutzername;
| }
|
| public String getPasswort()
| {
| return passwort;
| }
|
| public void setPasswort(String passwort)
| {
| this.passwort = passwort;
| }
|
| @Remove @Destroy
| public void destroy()
| {}
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997683#3997683
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997683
More information about the jboss-user
mailing list