How to instantiate the class using jsp:usebean when the class contains a constructor with arguments and does not contain a no-args constructor?? is it possible?? thanx Geeta
Matthew Phillips
Ranch Hand
Joined: Mar 09, 2001
Posts: 2676
posted
0
I don't believe it is possible because the javabean specification states that javabeans must have a no-arg constructor.
Matthew Phillips
Bear Bibeault
Author and opinionated walrus
Marshal
It is not possible. If you look at any Java class generated from a JSP that uses the <jsp:useBean> tag, you will see that an instance of the bean is automatically created using the no-args contructor if no bean of that name already exists in the scope specified by the tag. So if the "bean" class does not have a no-args contructor, the JSP class will not compile. hth, bear