Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Please Help me

Hi,

I am new to Java/J2EE. But i am learning J2EE from past 2 months. I learned Java. I have studied about EJBs(Session & Entity), Servlets, JSPs, Struts, XML, XSLT, JDBC, EJB Transactions, HTML, Oracle 9i & now I have installed WebSphere 5.0 in my system.

I need a help from you guys. I have all the bookish knowledge like what this does and what that does. But i lack practical knowledge.

If i am starting a small project, i dont know like where to use this servlet or where to use EJB. Suppose if i have a login page with JSP and if i submit the login where it should go like it should use a servlet or ejb i dont know all these. I have studied & understood about servlets, struts, ejbs , xml etc. But i dont know how to use them and link them each other when i want to develop a small application.

Please suggest me & guide me.

Thanks. :)
[889 byte] By [Dolly] at [2007-11-11 8:29:35]
# 1 Re: Please Help me
Even with your bookish knowledge, you should be able to make out [I don't blame you for confusing though] that servlets and EJBs are intended for a different purposes. Servlets are intended to handle requests for different protocols, the most common being HTTP for web applications. EJBs are, on the other hand, business components, which encapsulate business logic.

When you are talking about the example of a login page, after you submit, the browser generates a HTTP request, which can be handled by a servlet (in J2EE). EJBs are not designed to handle these. They come into picture when some business processing needs to be done. In the login case, you may have an enterprise bean [which would be an overkill] to validate the login data provided by the user. This could be called from the servlet which receives the request and needs to process it to decide the response [whether the user has logged on or not and the next page to be displayed accordingly]. The validation logic and/or some method(s) to retrieve user related data would be a part of the processing logic. This could be achieved in several ways, the least preferred and the most complicated being EJB. This could also be done by means of a bunch of plain Java objects with proper responsibilities.

Struts is a framework which provides some good features for developing web applications. I would suggest you to stay away from it till you get familiar with developing a simple web application using only servlet/jsp and some java beans [not EJB]. Having done that, you could proceed with other frameworks like Struts or Spring. I prefer Spring because it is almost a complete framework for enterprise applications, not just web applications.

I hope I was clear and I didn't toss in further confusions. :)
aniseed at 2007-11-11 22:35:18 >
# 2 Re: Please Help me
Thank You very much. I was clear.
Dolly at 2007-11-11 22:36:12 >