Beans by default have to have a constructor with no parameters...so to be
strict, jsp can't assume any constructors other than one with no
parameters.

It could be added as an optional tag though:

<jsp:useBean id=test scope=session class="com.myCompany.test"
createArgs1="var1" createArgs2="var2" />

And, all createArgs are either java.lang.String, or you then need to
specify the type, and handle cast errors.

But this gets a bit tedious....
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Play:        http://www.trongus.com




Why can't a developer provide a constructor with a parameter list?

<jsp:useBean id="test" scope="session" class="com.myCompany.test" />

Is is it just me or does this seem like a major pain.  If I want to use
a constructor with parameters I would have to write an initialize()
method and call it via:

<%
test.initialize("var1", "var2");
%>

IMO this just leads to bad code.  I am writing a bean that accesses an
Oracle database.  I would like to provde a database URL, logon and
password as part of the constructor.

Any ideas?  Is this slated to become a feature down the road?

Kevin

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to