Forums Register Login
Tabs in JSP

I want to show tabs in my jsp page dynamically. The tab id's or label may be selected from database dynamically and according to different tab id's different data should be shown(Same table should be refereshed for different tabs clicked- that holds the text field/labels as these field will too be dynamic in nature).

Can some one suggest how to sort out this problem.

Hi Vivek,

This is not one single question...

If you want to get things from a database, you have to use JDBC.
If you want to create content that will look like tabs in a web page with specific content each, you have to use JSP/HTML.

Try creating the tabs static (plain HTML, its just a TR with TDs on it) and then create a servlet that will get things from DB and them loop over them.

It is a very vague question...
hi Jorge,

Thaks for your response.
I am sorry if i was unclear to some extent.
what i want to do is show tabbed page's, where the label of tabs are selected from the database(depending upon the user profile) i am doing it using JSP, and now on depending the tab id different field's that user has to fill will be selected again from the data base.(That means one user may have tab1 with fields 1,2,3,4 or another may have tab 1,2,3,4,5 each having different multiple fields).

And if the number of tabs are greater than 4, i'll have to show a button from where user may be able to scroll the tabs and go to the next tab.

I don't think he meant that your question wasn't clear.

You're asking how to do something that spans several technologies.
There is no such thing as a tab in JSP.
People create pages that appear to have tabs using various tricks in HTML.
Retrieving data from a database is a different issue altogether.

If you are stuck on a particular aspect of this project we can move this thread to the forum that is most likely to have the people who can help you but, if all you can do is list your requirements, the best that we can do is to give you a list of technologies to study.

Are you familiar with HTML and JDBC?
Do you know how to get the results of a database query to a JSP page?

If you are familiar with HTML, a good way to start is to build a static page
that looks the way you want your finished product to look.
From there, it isn't hard to plan out a way to draw the same tabs in a loop with data from your database.
[ March 04, 2008: Message edited by: Ben Souther ]
Hi Ben Souther,

Retriving data or showing it in jsp using html tags is not my problem,thats a easy task and i am using EJB's(CMP to be more specific) to fatch the data out.

I have the tabid's in a array on my jsp. and corrosponding fields according to tabid's in different collection.

My problem is if it had been only 2 or 4 tabs it could be easily accomodated but if tabs may go up to 20 in number then what...... ??
So in such case how to accomodate all tabs all together,(one solution that i saw some where is to scroll the tabs with next and previous button.)

However i don't know how to do this scrolling effect......??

Is there any seperate forum where i can get the people who can help me out with this problem, then please move this thread.

Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 6154 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 25, 2018 07:01:22.