David Stone wrote:
>In JSP, what are the advantages to using the <jsp:XXX> syntax to access
>components rather than just accessing the components via the scripting
>language?  IE, why would I do this:
>
><jsp:useBean id="whatever" class="who.cares">
>...
><jsp:setProperty name="whatever" property="stuff" value=99>
>
>instead of this:
>
>who.cares whatever = new who.cares();
>whatever.stuff = 99
>
>
>The beans can have a scope besides page scope and can have members
>corresponding to form fields set automatically.  Is there anything else?
>I'm just trying to make sure I'm not missing something...

Dave,

If you've got a team that combines both Java developers and HTML
folks, then the syntax issue itself is an advantage. The <jsp:XXX>
tags are more familiar-looking to the HTML wizards and therefore (one
would hope) less intimidating. If you can teach them how the three
bean tags work and what their dependencies are, then it's likely they
won't have to involve the Java programmers when they want to change
the page layout somewhere down the road.

If, on the other hand, your developers are equally at home with both
Java and HTML, then you could go either way. In fact, you can make
calls to the pageContext implicit object that will let you store and
retrieve objects in whatever scope you want.

You're right about automatically setting properties from form fields,
though. There's no simple mechanism for doing that from a scriptlet.

- Mark A. Kolb                          Staff Engineer
   [EMAIL PROTECTED]                  Tivoli Systems Inc.
   http://www.cross-site.com             (512) 436-1955

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to