Scott Kumamoto wrote:
>
> This brings up a question I've been trying to figure out... why does the
> "jsp:useBean" exist at all?  (Versus just doing a "new myClass()"?)
>
> Are there technical reasons for it?  The only thing I could think of was
> that forcing the JSP writer to do the "new" was too "Java", and giving
> then the "jsp:useBean" was more "HTML", thus aiding the role separation
> of programmer and HTML (JSP) developer.

<jsp:useBean> does a bit more than "new myClass()". It first try to locate
an existing instance with the specified name. If it can't find one, it
creates a new instance and saves it in the specified scope. Sure, you can
do all this with a few lines of Java code in a scriptlet. But even small
amounts of code in a page can create syntax errors that are hard to catch,
because the scriptlet code is mixed with the code generated by the JSP
container. Another reason for the JSP action elements is that they are
a better fit for authoring tools.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
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

Reply via email to