IBRA
IBRA

Reputation: 1782

Create static table through Java code

I want to create a static table using Java code to join it with another table from the database.

I know the number of columns and rows and the data, nothing of them is going to change at all, all of the values are constant.

The table will not be created in the database, it's only in the code and will be created when the application started.

I am new at Java coding, I used to work on C#, and I searched a lot through the internet, all what I found is how to create table in database which is not what I'm looking for. Any help would be appreciated.

Upvotes: 1

Views: 2285

Answers (2)

Seem
Seem

Reputation: 271

You can use ResultSet but you'll see that it's not like DataTable in c# you can refer this link, maybe it will help you DataTable equivalent in Java

Upvotes: 1

ozoli
ozoli

Reputation: 1424

For a example of using a table in JSP see the answer here

In your case you could have a static List and add that to the "Cars" you get from the database.

Also if you want the table properly sorted take a look at implementing the Comparable interface.

Upvotes: 0

Related Questions