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
Joined: Jun 15, 2004
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.
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.
Joined: Jun 12, 2004
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?