Call java bean in jsp

Hi,
I wrote a javaBean and placed it in …/application_server/beans. I also wrote a jsp file. This file was placed in …/application_server/server/webapps/ROOT.
I need the jsp to talk to the java bean. I added "<%@ page import = “java.util.,java.io.,“Test.testBean”%>” and “<jsp:useBean id=“test” scope=“page” class=“Test.testBean”/>” into the jsp file. But I got an error:
“The value for the useBean class attribute Test.testBean is invalid.”
There is a default constructor in the class Test.testBean.
Does some one know how to fix this?

Thanks,

The way you use it you have to add the complete path to the bean (and there can be much more going on but you hardly give enough info).

But why don’t you use the bean from within Servoy.

I used the bean within Servoy. I also want the jsp file to talk to this bean to set properties as the jsp file cannot talk to the form. The full path of the bean has been given in the jsp file. What other info do you need? I can give the details.

So, you are sure the bean works?
How did you set your classpath?
What is it that you need from a form that you can not get from the bean?
What is the bean supposed to do?

I put the bean.jar file in …/application_server/beans for the form to access it; the form retrieves data and passes the data to the bean to do processing and the bean writes data to a temp file; the form opens a jsp page(jsp file is in …/application_server/server/webapps/ROOT) to download the file. I need the jsp page to set a flag in the bean when it finishes downloading; the form monitors that flag and will close itself when the flag gets set. Now the bean works fine with the form.

Hmm, there is too much going on to help you with this.

Maybe your bean can not work with a jsp page.

I would see what hits you get when you search for ‘The value for the useBean class attribute Test.testBean is invalid’.
I have seen (too) many so I think you must be able to find a solution to your problem from these.

As for servoy is there no rule about where the bean.jar file should be placed?

Yes, there is.
It is the beans folder.
But when you are going to do JSP the territory is yours and not that of Servoy.
It is easy to confuse JSP with Headless Client (if you do/did) but it is not the same.
It is the JSP that you use to call a Headless Client instance.

Hey there Marcel,

Bean questions certainly seem to come up a lot on the forum. Maybe I can talk you into posting a short how-to on the Java blog. I think it would be very beneficial for the community; time permitting.

You already have an author account… :wink:

Hi Marcel,

I agree, you are the guru on this subject and I’m sure we’d all appreciate some of your wisdom in this area in an easy to access place. Would you consider putting your experiences on the Java blog?

I know and I could and I should.
But this is not on the top of my list guys.
I have promised to do this and I will eventually but…