File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to build good website on JavaEE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to build good website on JavaEE?" Watch "How to build good website on JavaEE?" New topic
Author

How to build good website on JavaEE?

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 481
    
    1

Hello!

I have recently read that EJB is for enterprise applications and not for web applications.
I use EJB in developing my website.

I am eager to know what I should really use to build very good web application using JavaEE.

How can I replace EJB if EJB does not suit for webapp?

Why do people say that javax.faces.bean.ManagedBean annotation is bad and javax.inject.Named is better?

Thank you!


True person is moral, false is right!
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 122

There are solutions out there that may offer something that is better than Ejb in some scenarios.

Spring services (any simple Spring bean) is one.

EJB is for enterprise applications and not for web applications


Without knowing the context of that statement you mentioned, it is hard to guess what that document was referring to.

Ejb would require you to have an ejb container. If you use Spring instead of Ejb, you can run a good web application using a web container only.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 481
    
    1

Thank you for response!

I thought EJB container is on all servers(like Glassfish, Tomcat, JBoss).

You think that to build good website I need Spring instead of EJB.
Does Spring do handling transaction, concurrency, interceptors, security by default as EJB?
Does Spring allow stateless , stateful and singleton beans?
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 865
    
    5
Volodymyr Levytskyi wrote:
I thought EJB container is on all servers(like Glassfish, Tomcat, JBoss).



Tomcat alone is a servlet container (Servlet + JSP) but not a fully-fledged Enterprise environment.
See also Apache TomEE.
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 122

If you are aware of the old entity ejb bean, you know how painful ejbs are a few years ago.

Spring flourished due to stuff like that.

Spring grew not just as a complement or complete replacement to EJBs.

In the Spring reference pdf (for Spring 3.0.7), it mentions only 1 scenario where you may need to use EJB instead:

The Spring Framework does not support propagation of transaction contexts across remote calls, as do
high-end application servers. If you need this feature, we recommend that you use EJB. However,
consider carefully before using such a feature, because normally, one does not want transactions to
span remote calls.


Everything you mentioned (transactions, etc.) can all be done in Spring. Spring is a huge framework now. Try read a wiki on Spring or anything and you will see.

Just to add, java now supports injection of some sort, similar to Spring, but not yet as much.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 481
    
    1

Thank you for responses!

Probably it is better to use Spring to build cool websites than EJB.
I only study JavaEE now.
I covered Antonio Goncalves 'Beginning JavaEE6 with Glassfish' and javaee tutorial completely.

I decided to develop my own cool website like javaranch. Now I see that EJB (I use) is for enterprise app but not for websites.

Can you give me example (better link) of enterprise application with EJB, JPA, JSF? I shall try to develop your example after I finish current website.
I am learning Java for 2 years and nobody has given me any task. I have been rejected for about 10 times.
It happened because I did not learn single technology but was jumping from JavaSE to JavaSwing and finally to JavaEE.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
A good web site doesn't depend on the technologies being used - it doesn't matter whether you use EJBs or Spring or neither. It depends on doing something that its users need done in an intuitive to use manner. Information design, visual design, performance and scalability are likely to be more important than the underlying technologies.


Ping & DNS - updated with new look and Ping home screen widget
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 865
    
    5
Ulf Dittmer wrote:It depends on doing something that its users need done in an intuitive to use manner. Information design, visual design, performance and scalability are likely to be more important than the underlying technologies.


True but of course the question arises: how to achieve performance and scalability and stability and security etc. They have to do with the underlying technology.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
Both EJB and Spring can be used to build scalable and performant web sites, and both can be used to build non-scalable and terribly slow web sites. The same is true if you use neither framework. You need to kow what you're doing, and that's true regardless of the technology being used.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to build good website on JavaEE?
 
Similar Threads
EJB 2.0
Please guide me in advance java
J2EE in future?
What, besides servlets and jsp, may be used for web-application?
Website Security