> -----Original Message-----
> From: A mailing list about Java Server Pages specification
> and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Phil
>
> As I understood it, Heiko was asking why use JSP tag
> <jsp:useBean...> when
> you can do the same by creating an instance of the java
> "bean" object...
> (the original e-mail subject line may have sent the conversation in a
> different direction).
>
> It seems the <jsp:useBean> tag is redundant. According to the
> specs, a bean
> is just a java component, requiring "serialization support"
> and "get/set
> accessors." According to the-wally-project tutorials, "JSP is an html
> friendly servlet." Other than limits imposed by design
> preference, what ever
> you can do in a servlet you can do in JSP, including:
>
> <%  MyBean mybean = new MyBean() ;
>         mybean.setSomeVar( "somevalue" ) ;  %>
>
> So, why use JSP tag <jsp:useBean...>?

I was wondering the same myself, coming from a background of servlet
development. I don't currently use the bean tags at all and was wondering
what I was missing...
I do however make extensive use of beans in my JSPs, I just create/use them
conventionally as per your example.

One reason might be that the <jsp:...> bean tags are language neutral, so
that a user of a bean can work with minimal knowledge of Java. This might
become more important when using JSP with XML and tag libraries as these
could prove to be a powerful combination even for those who don't know Java
at all - they merely need to know what the various tags and beans can do and
what the attributes/interfaces/properties are.

As someone else said here, JSP builder tools will soon be available (eg
Visual Cafe 4 Enterprise Edition) which will provide integrated WYSIWYG
JSP/HTML building and debugging - I expect beans will be important for this.

When using beans with application, page or session scope I suppose it does
simplify things a little too - particularly application scope.

Btw seems like servlet beans don't even seem to have to strictly be beans at
all - ie don't even have to be marked as serializable - any class will do -
implementation specific I would guess though.

Steve

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