GeeCON Prague 2014*
The moose likes Servlets and the fly likes JSP, Beans and Servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP, Beans and Servlet." Watch "JSP, Beans and Servlet." New topic
Author

JSP, Beans and Servlet.

Weronpc
Greenhorn

Joined: Jun 12, 2004
Posts: 26
Hello all, I finds most tutorials I read so far for Servlet is for forms. JSP is for out put html, Java Beans is for database interaction.

One thing I don't know is, how do they interact with each other? I understand what each of them are, but don't understand how they work with each other.

Thank you all,

Mike

PS: Also, what is J2EE? Many job posting want J2EE experience.
[ June 15, 2004: Message edited by: mike chi ]

1 + 1 = 10
Leo Deegan
Greenhorn

Joined: Jun 15, 2004
Posts: 12
Hi Mike,

By Java Beans, I'm sure you meant Enterprise JavaBeans (EJBs). You can use the three technologies in a web application. The JSPs provide your webpage content; requests can be handled by a ControlServlet, say; and you can use EJBs for the data persistence.

Suppose the web app is like a bookstore, and it allows the user to save their book selections for purchase at a later time. The ControlServlet can handle a request like "http://www.myexamplebookstore.com/controlServlet?saveBooks=true", and the ControlServlet can use an EJB like LibrarianBean (okay, that's laughable) to persist the user's book selections to the database.

Hope that helped,
--Leo
Leo Deegan
Greenhorn

Joined: Jun 15, 2004
Posts: 12
Oh, I saw your p.s.

J2EE (Java 2, Enterprise Edition) is a catch-all set of code and specifications for developing enterprise level applications. J2EE includes JSP, Servlets, and EJBs. J2EE also provides APIs for handling XML, SQL, mail and messaging, along with other things of interest to enterprise developers.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Since you already have a similar post in the EJBs and Other J2EE Technologies forum, I suggest using that thread for your general J2EE questions.

I'm moving this to the Servlets forum for a discussion the Servlets-JSP-JavaBeans system design and interactions.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Servlet is for forms. JSP is for out put html, Java Beans is for database interaction. ... how do they interact with each other?

A lot of folks will design their web applications following the Model-View-Controller (MVC) pattern, sometimes referred to as Model 2, or MVC 2.

Rather than regurgitate what others have said many times on the subject, let me point you to two pages on the original wiki, ModelViewController and MvcInJspModelTwoArchitecture. Also, a quick search on this forum will likely nab a good explanation or two. Note that the search page link is at the top right of this page.

Good luck, and of course if you have further questions on the subject, don't hesitate to ask. Though, keep in mind that we prefer that most design-based questions be held in the OO, Patterns, UML and Refactoring forum.
Weronpc
Greenhorn

Joined: Jun 12, 2004
Posts: 26
Thank you all for you reply, you guys are nice people.

Could someone give me few lines of codes (example codes) how a servlet send info to jsp?
 
GeeCON Prague 2014
 
subject: JSP, Beans and Servlet.