我在下面有一堂課;seam @Out註釋是否有效?
package org.domain.emlakprojesi.session;
import java.util.List;
import javax.persistence.EntityManager;
import org.domain.emlakprojesi.entity.ziyaretci;
import org.jboss.seam.ScopeType;
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.log.Log;
import org.jboss.seam.security.Credentials;
import org.jboss.seam.security.Identity;
@Name("authenticator")
public class Authenticator
{
@Logger private Log log;
@In Identity identity;
@In Credentials credentials;
@In EntityManager entityManager;
@Out(scope =ScopeType.SESSION,required=false) ziyaretci girisYapanZiyaretci;
public boolean authenticate()
{
log.info("authenticating {0}", credentials.getUsername());
List<ziyaretci> ziyaretciler =entityManager.createQuery("from Ziyaretci where email = #{credentials.username} and sifre = #{credentials.password}").getResultList();
if(ziyaretciler.size() == 1){
this.setGirisyapanziyaretci(ziyaretciler.get(0));
return true;
}else
return false;
}
public void setGirisyapanziyaretci(ziyaretci girisyapanziyaretci) {
this.girisYapanZiyaretci= girisyapanziyaretci;
}
public ziyaretci getGirisyapanziyaretci() {
return girisYapanZiyaretci;
}
}
我設置girisYapanZiyaretci在身份驗證方法
當我運行該應用程序我得到空指針異常
其實我問什麼時候@In和@Out註釋工作?
好的非常感謝你和我有一個小問題太多:如果我注入在一個事件時,注入的場被破壞(事件或會議結束結束) – daemonThread 2012-02-08 21:49:27
scobed會話bean scobe組件發生了什麼如果不綁定任何方法,並且只使用bean的值綁定,那麼@ updateModalValues之前的工作階段? – daemonThread 2012-02-08 21:57:31
在回覆中增加了一些說明 – 2012-02-09 15:16:11