Jason,
EJB's and JavaBeans are used to move the business logic of your application
out of the presentation layer (JSP) and into the model in the MVC
architecture.  The JSP is the view in this architecture.  EJB's and
JavaBeans can be used to encapsulate persistent data such as a database
record.  JavaBeans are also typically used to encapsulate form data.  By
putting form data in a bean, you can have a form be prepopulated with data
that has been entered previously.  This is useful when you have a series of
form inputs or when you validate form input data and need to display a page
again because the user skipped a mandatory field.  EJB's can be used for
several different purposes such as maintaining session values or storing a
database record for display by a JSP.  EJB's and JavaBeans are used to hold
data that is displayed by the view.

It is not a good practice to put a lot of control logic or other code in a
JSP.  The code should reside in EJB's, JavaBeans, custom tags, or
controller servlets.

Regards,

Richard


At 12:31 PM 10/30/01 +0800, you wrote:
>To All JSP Interest,
>
>     First, thank you for Andrew and Richard answer my previous question?
>
>     My second question is what is the role of EJB or JavaBean in JSP? If
>possible, please give me an example.
>     I know that in JSP I can use the package JDK included and some others.
>Then, why I need EJB or JavaBean?
>
>Thank you,
>
>Jason
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to