473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

bean using other classes

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
Jul 18 '05 #1
0 2506

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pat Kelley | last post by:
I am trying to feed database column data into a bean using JSTL expression language: <jsp:setProperty name="fileWrite" property="fileText" value="1"/> <c:set var="test" value="test"/>...
0
by: jenniferyiu | last post by:
Hi. I downloaded the bean builder and followed the steps told on http://java.sun.com/products/javabeans/beanbuilder/1.0/docs/guide/tutorial.html and the sample tools was created as the above...
3
by: Miles Davenport | last post by:
I have the following code (please see base of email) which displays text from a properties file ok. I have changed the properties file so the contents are different, but cannot get the new...
0
by: Borek | last post by:
In my project I have to access in one business method of session bean usually more then 10 CMP Beans. I would like to have some utils classes, which could get me right instance of CMP or create...
5
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and...
61
by: Steven T. Hatton | last post by:
Stroustrup's view on classes, for the most part, seems to be centered around the notion of invariants. After a bit of adjusting to the use of yamt (yet another math term) in computer science, I...
2
by: nvidia1 | last post by:
Hi this is my first post but so far this is pretty good site. I have a file called index.html with the following code: <!-- index.html --> <html> <head><title>Student Registration...
0
by: jaisi | last post by:
What iam exactly trying to do is..saving the resultset in a bean.....and calling the bean in a servlet and forwarding it to jsp by setting the bean in the request scope; Now i have only one record...
1
by: hostel | last post by:
HTML PAGE <html> <body> <form action="second.jsp" method="get"> YOur name <input type=text name="name"> <input type=submit > </form> </body> </html>
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.