>  That's what I've said, but I've also said that in "scope=request" case
> it *does not* matter which one to use. That's because every time a
> request comes to a JSP page, a new bean is created (scope="request").
> Therefore, both are the same as long as we use "request" or "page"
> scope.

That's not quite true. - what if you do this

<jsp:useBean id="foo" scope="request" />
<jsp:setProperty name="foo />

and you do a

<jsp:Include name="bar.jsp" />  and bar.jsp also has the above code!

This means the above property will be reset by bar.jsp - not what you want
at all.

If you are using <jsp:setProperty ... /> to initialise the bean, use it as
part of the useBean body. There it will have fewer side-effects, and the
bean is better encapsualted.

Kevin Jones
DevelopMentor
www.develop.com

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
> reference [mailto:[EMAIL PROTECTED]]On Behalf Of Jacek Laskowski
> Sent: 07 September 2000 17:55
> To: [EMAIL PROTECTED]
> Subject: Re: Question regarding JSP and HTML forms
>
>
> Kevin Jones wrote:
> >
> > The difference bewtween
> >
> > <jsp:useBean
> > <jsp:setProperty
> > </jsp:useBean
> >
> > and
> >
> > </jsp:useBean ... />
> > </jsp:setProperty />
> >
> > is that in the first case the setProperty only gets called when
> the bean is
> > created, whereas in the second case the setProperty is always called.
>
> That's what I've said, but I've also said that in "scope=request" case
> it *does not* matter which one to use. That's because every time a
> request comes to a JSP page, a new bean is created (scope="request").
> Therefore, both are the same as long as we use "request" or "page"
> scope. In the later, however, you save some extra typing:)
>
> > Kevin Jones
>
> Jacek Laskowski
>
> ==================================================================
> =========
> 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

Reply via email to