PDA

View Full Version : Javabean questions


compassman
12-24-2006, 10:22 PM
I have been trying to learn how to add javabeans to my JSP website. I have some, probably, stupid questions. Any help will be appreciated.


Where, exactly, does one put the javabeans? Is it under WEB-INF in itsown folder? Can it be under a common folder?
When calling a bean, is the syntax [foldername].[javabeancompiledclass] or is the header something else?
I have an example bean I have tried to compile without success. Can anyone tell me what is wrong?

* mybeans.java <- this is not part of the file
package mybeans;

public class lineBean
{
public String stars(int x)
{
String text="<br>";
for (int i=0;i<x ; i++)
{
text=text+"*";
}
return text+"<br>";
}
public String doubleLine(int x)
{
String text="<br>";
for (int i=0;i<x ; i++)
{
text=text+"=";
}
return text+"<br>";
}

}

I am using javac to compile it. Is this the right tool or is something more appropriate?

Thanks for any help I can get.

ess
12-25-2006, 03:22 PM
This quite a large topic to cover in one post.

therefore, I am going to recommend that you install NetBeans (http://www.netbeans.org/). It is a free IDE by Sun Microsystems and it should make JSP development a straight forward task.

It will assist in creating Beans, Frames, Applets, JSP pages, Servlets etc.

If you look at http://www.netbeans.org/ you should find a large selection of tutorials on how you can utilize netbeans to create Web and/or desktop applications.

Good luck.
Ess