Hello everybody
I have a problem as a newbie in using beans and I hope someone out there can
help me with this.
I have a jsp-page that use BeanClass. Somewhere in the jsp code there is the
following scriptlet:
<%
Vector vec=BeanClass.getStateVector();
%>
The BeanClass has the method:
public Vector getStateVector(){
return vec;
}
So, all this works great. But what do I have in the Vector? I have a
collection of String. And this is not enough.
I need something else in this Vector. For example i would need to put both a
String, an int and a boolean in every matrix of the Vector. How do I solve
this? I thought the most natural was to create an instance of a class that
could hold all the three properties.
So I create the class State. The class has a constructor that sets the
String state_name, the int state_id and the boolean selected.
In the bean I put new elements in the Vector by doing something like:
vec.put(new State("NY", 1, false));
So, am I doing the right thing? I hope so. I tried to compile the bean and
it seemed to work. So, what is the problem?
The problem is the jsp. The jsp doesnt recognize the class State. I dont
understand why. I mean, I put the class in the same directory as the beans.
Should I maybe put the class even in the same directory as the jsp-file? I
never used beans before, so Im missing something, I hope someone can explain
what Im doing wrong.
Regards
Alf