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. I
prefer the first case for a number of reasons -

I can't accidently do this

<jsp:useBean />
<% use the bean %>
<jsp:setProperty />

It gives me better 'encapsulation', I'm sure the bean is fully constructed
before using it, etc.

You pays your money and you takes your choice.

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 10:29
> To: [EMAIL PROTECTED]
> Subject: Re: Question regarding JSP and HTML forms
>
>
> Kevin Jones wrote:
> >
>
> > The JSP page can access the form params any number of ways but typically
> > through
> >
> > <% myParam = request.getParameter("ParamName" %>
> >
> > or more likely
> >
> > <jps:useBean id="FormHandler" class="xyz" scope="request" >
> > <jsp:setProperty name="formHandler" property="*" /?
> > </jsp:useBean>
>
> As you showed the above example with <%%>, I thought about the bottom
> one, but with one little difference. I'd rather write
>
> <jsp:useBean id="FormHandler" class="xyz" scope="request" />
> <jsp:setProperty name="formHandler" property="*" />
>
> Note the '/'s at the end of tags.
>
> I think in this particular situation the bean will live only during a
> request, so it doesn't matter where <jsp:setProperty> is. Am I right ?
>
> <
> >
> > 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