What do you mean by you want to run it once ?!! What is the scope of yor bean ?
     If you'd like to have the same behaviour as a constructor, the exemple i gave
you should work. If your beans scope is session, the <% toto.init(arg1, arg2);%>
will only be called the first time the <jsp:useBean .. > will be seen in a session.
Then , as the bean has  already  been created, this code won't be run again, even
if the user come's back to the same page, within the same session !
    It is the same with a scope application ...

I'm not sure I answered your question this tome :) Don't hasitate to  ask again !
Regards
Veronique

Mike Lai a �crit :

> Hi Veronique,
>
> Thank you very much, that's exactly what I want to know.
> One more question, if I use <% toto.init(arg1,arg2);%>, then it will be
> coded into the jspService function, right? But I only want it to be called
> once, can I use <%! toto.init(arg1,arg2);%> instead?
>
> Regards,
> Mike
>
> -----�?�l�l?�-----
> �H?�??: Veronique Dupierris <[EMAIL PROTECTED]>
> ��?�??: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> ���: 2000�~9��26�� PM 04:45
> ?D��: Re: bean and jsp question
>
> >If you want to use the useBean tag, your constructor should NOT have
> argument.
> >That's a part of the beans definition.... Of course you could find a
> workaround.
> ><jsp:useBean id="toto" class"..." scope="..."  >
> ><% toto.init(arg1, arg2); %>
> ></jsp:useBean>
> >
> >    The code between <jsp:useBean..> and </jsp:useBean> is only executed
> when the
> >instance is created ....
> >
> >Hope this help
> >Regards
> >Veronique
> >
> >Mike Lai a �crit :
> >
> >> Hi,
> >>
> >> I just start learning jsp and java bean, please give me some hint.
> >>
> >> My question is: can a bean has constructor that takes argument? If yes,
> >> how can I pass the argument using the <jsp:useBean> tag to do it?
> >> Thank you very much.
> >>
> >> Mike
> >>
> >>
> ===========================================================================
> >> 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
> >
>
> ===========================================================================
> 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