hi,
at first I do agree with what you said, the combination of JSP + Bean
is pretty fine. But when you are in a complicated program, I would advice
you to have JSP+Servlet+Bean.
it is easy to write a workable program, but it would be hard to write
a maintainable and portable program. The JSP for sure is only for
presentation purpose so that HTML designer dun have to worry (since it is
not going to maintain by programmers). Servlet would be catering business
logic like
// process business logic from user input
if (req.getParameter("options").equals("A")){
//do something
}else {
//else do something
}
OR
//make use of bean to process business logic
if (beanA.validateUser()){
// do something like
beanB.updateDatabase();
}else{
// do something else
}
Bean would be handle the backend process, like database query, update
and so on.
any comment?
"Craig R.
McClanahan" To: [EMAIL PROTECTED]
<Craig.McClanahan@EN cc:
G.SUN.COM> Subject: Re: Difference between
Servlet and
Sent by: A mailing Bean?
list about Java
Server Pages
specification and
reference
<[EMAIL PROTECTED]
un.com>
11/17/00 06:10 AM
Please respond to A
mailing list about
Java Server Pages
specification and
reference
Anthony Mak wrote:
> Dear Sanjay,
>
> If I have Bean handling all the business logic and JSP pages for
> presentation, do I still need to use Servlet? It seems a JSP
(presentation)
> + Bean (business logic) combination will suffice at least for small
> application. Can you think of a situation where I might need to use
Servlet
> as well?
>
Many application frameworks implement the Model-View-Controller (MVC)
paradigm,
which is also popular in GUI application design. In a web app, the most
common
division of function looks like this:
* Model = beans
* View = JSP pages
* Controller = servlet
Business logic can be implemented in a variety of ways, but is most often
found in
action classes managed by the controller, in JavaBeans, or in EJBs.
For one example of a framework that is organized in this manner, check out
the
Struts framework at <http://jakarta.apache.org/struts>.
>
> Anthony Mak
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets