[jboss-user] [JBoss Seam] - Architecture Question

jl_monteagudo do-not-reply at jboss.com
Fri Aug 18 10:43:09 EDT 2006


Hello mates,

I?ve been looking for this question in the forum, but as I?ve not found a response for it I expose my doubt here.

I?ve been working successfully till now with EJB3 and JSF, and now I want to try Seam. So, I?m reading the Seam Tutorial and there is a sentence that I can?t see quite clear : Most Seam applications use session beans as JSF action listeners.

There is the Example 1.2 below this sentence :


public String register() {

      List existing = em.createQuery("select username from User where username=:username")
         .setParameter("username", user.getUsername())
         .getResultList();
         
      if (existing.size()==0) {
         em.persist(user);

         log.info("Registered new user #{user.username}");
         return "/registered.jsp";                    
}
      else
      {
         FacesMessages.instance().add("User {user.username} already exists");         
         return null;
      }
   }


My doubt is that if I work in this way I tie my business tier to my view tier, so I can?t reuse my business logic in standalone applications, for example. I know that Seam was created in order to work with web applications, but anyway I think that it?d be a better practise to develop SLSB without mixing it with web code, and on the other hand, develop a JSF action listener that use the SLSB.

Don?t you think that this is a better structure or is there something that I ?m not understanding?

Thank you for your explanations.

Best regards,

Jose Luis Monteagudo



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

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



More information about the jboss-user mailing list