aspose file tools*
The moose likes Servlets and the fly likes Using Beans with non-null constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using Beans with non-null constructors" Watch "Using Beans with non-null constructors" New topic
Author

Using Beans with non-null constructors

Richard John
Greenhorn

Joined: Feb 14, 2001
Posts: 8
Here's a simple question, I daresay the answer is going to be a simple you can't do that, but a word from an "expert" would settle my mind!
I've been using beans in my JSP files like so:
<jsp:useBean id="loginBean" scope="page" class="com.rttp.CheckLogin">
These beans have empty constructors, all nice and easy.
Now suppose I want a java class that that has a constructor, say:
public ObjectManager (String msg)
{
System.out.println(msg);
}
How do I use this class as a Bean using the useBean tags? Or is this now not a bean?

Thanks for your help.
Rich
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
In order for a class to be a bean, one of the requirements is that it has a no argument contructor. Your example doesn't have a no argument constructor, so it's not a bean.
Jay
Richard John
Greenhorn

Joined: Feb 14, 2001
Posts: 8
I should have known you were going to say that!
Anyway thanks... I just needed to hear it from someone else :-)
Richard John
Greenhorn

Joined: Feb 14, 2001
Posts: 8
I should have known you were going to say that!
Anyway thanks... I just needed to hear it from someone else :-)
 
 
subject: Using Beans with non-null constructors