File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP with tabs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP with tabs" Watch "JSP with tabs" New topic

JSP with tabs

Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
I have been asked to develop a JSP application. Basically it consists of one screens with 7 tabs. Each of these tabs are divided in two section. The top section will have search criteria and bottom will have result set
as master details or simply master only. They will do insert/update/delete etc and screens have standard controls like list box, radio buttons, check boxes etc. It is fairly GUI.
I was intending to use BC4J and JSP combination, BC4J comes part of Jdeveloper(Oracle product). But client told me to not use BC4J as this
will make them dependent on Oracle suite. The application needs to be
independent of third party classes(anything from Open source is fine though).
Any idea how can I do this? I belive JSP will be the way to go. Is there an
IDE I can use to keep coding minimum. What I have seen is that JSP means a lot of code... we have only 3/4 weeks to do this.

Any clues/help will be appreciated.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
it's possible.
You need a piece of Javascript that submits the requests and loads the results into a div which represents the tab.
We've created something like that last year and it works well (code is proprietary, sorry).
It DID take longer than 3-4 weeks to get it working properly and code the application around it. If that's your deadline you're out of luck, if you have a star Javascript programmer you might get the code in time but you won't have time to get it all integrated and tested.
Another option would be to submit everything every time a new tab is requested. This is easier to build.
We decided against it as it makes the screen flicker (for a moment depending on connection speed your browser screen will go blank when a new page is loading, this is normal but not what users expect in a tabbed screen).
You can keep track via a request parameter which tab has been requested and load only that via a c:choose tag.

Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
I was looking at JSP option not using Java script. From your post seems you used Java script.Is that right? We are lookig at Vanilla solution, no depenednies on Oracle provided BC4J etc.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Since JSP is merely a templating technology used to create HTML pages to be sent to the browser, your tabs need to be rendered using HTML. Your JSPs can help dynamically format the HTML that is sent to the browser, but it all comes down to plain old vanilla HTML.
If you do not want to use Javascript to control the "tabbing" on the client side, then you will need to resubmit and redraw the page to implement the tab switching.

[Asking smart questions] [About Bear] [Books by Bear]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
Bear is right.
In addition to his comment I would like to add that you may need to design a custom tag that takes care of the tab traversal(that can retain the overall parameters of your submit).
And if you take that approach it is not black and white. Where I come from, when I refer to the code that accomplishes this issue, it is not easy to implement as a reasonably generic tag.

SCJP, blog
brad balmer
Ranch Hand

Joined: Mar 08, 2004
Posts: 57
Take a look at struts-menu:
It uses javascript and cookies to accomplish it's tasks. I was easily able to extract out what I wanted and write my own tag that doesn't use javascript (Sorry, can't give out the code).
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Yes, we went with a Javascript solution.
There's a JSP that has a DIV on it which serves as the tabcontrol with some nested divs to hold the tab headers and the data).
When the user clicks a tab header Javascript loads another JSP and insert the generated HTML into the innerHTML of the inner DIV, giving the appearance of a new tab being opened (especially as it also changes the colours and borders of the tab headings to give the appearance of a standard Windows tabbed dialog).
The Javascript takes care of submitting formdata as well.
A similar solution could be coded in all JSP as well of course, but would require the entire page to be sent back and rebuilt every time another tab is selected, something we didn't want.
sun ram
Ranch Hand

Joined: Dec 18, 2001
Posts: 61
Use JSP 2.0 you can reduce lot of coding. also look at this
product, this will give you some idea.

I agree. Here's the link:
subject: JSP with tabs
It's not a secret anymore!