aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes tabs and subtabs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "tabs and subtabs" Watch "tabs and subtabs" New topic

tabs and subtabs

gurudev arer

Joined: Apr 01, 2008
Posts: 6
I am having a JSP page with 3 tabs. It is working fine.
But now i have to add subtabs to it. I used the same script , but it is not working.
It is giving me the below error

javax.servlet.ServletException: java.lang.StackOverflowError

The JSP page and the JAVA SCRIPT is below

<script type="text/javascript" src="<%=request.getContextPath()%>/js/Tabs.js"></script>
<link href="<%=request.getContextPath()%>/css/subtabs.css" rel="stylesheet" type="text/css" />
<table height="100%" width="100%" cellpadding="2" cellspacing="0">
<tr height="100%" valign="top">
<td width="90%">
<div id="tab1" style="display:none"><%@ include file="1.jsp" %></div>
<div id="tab2" style="display:none"><%@ include file="2.jsp" %></div>
<div id="tab3" style="display:none"><%@ include file="3.jsp" %></div>
<table width="100%" align="center">
<script type="text/javascript">
vTab_initTab = 1; // initialize with tab #1 selected.
Tab('tab1','TAB 1','tab2','TAB 2','tab3','TAB 3');


var vTab_initTab = 1;
var vTab_tabid = new Array();
function Tab() {
var vTab_args = arguments.length;
if(vTab_args < 1) return false;
if((vTab_args / 2).toString().indexOf('.') > -1) return false;
var vTab_i;
document.write('<table class="Tab" cellspacing="0" cellpadding="5" width="100%">');
document.write(' <tr>');
for(vTab_i=-2;(vTab_i+2)<vTab_args;vTab_i+=2) {
vTab_tabid[vTab_tabid.length] = arguments[(vTab_i+2)];
document.write(' <td width="12.5%" align="center" ' + (((((vTab_i+2)/2)+1)==vTab_initTab) ? 'class="Tab_tabon"' : 'class="Tab_taboff"') + ' onmouseover="fTab_mouseover(' + (((vTab_i+2)/2)+1) + ')" onmouseout="fTab_mouseout(' + (((vTab_i+2)/2)+1) + ')" onclick="fTab_click(' + (((vTab_i+2)/2)+1) + ')" id="Tab_tab' + (((vTab_i+2)/2)+1) + '"><h3>' + arguments[(vTab_i+2+1)]+"</h3>");

document.write(' <tr>');
document.write(' <td align="left" valign="top" class="Tab_content" colspan="' + ((vTab_args / 2)+1) + '">');
document.write(' <div id="Tab_content">');
document.write(' tab\'s content');
document.write(' </div>');

for(vTab_i=-2;(vTab_i+2)<vTab_args;vTab_i+=2) {
if((((vTab_i+2)/2)+1)==vTab_initTab) {
try {
catch(vTab_err) { }

function fTab_click(vTab_tabnumber) {
if(vTab_tabnumber==vTab_initTab) return false;
var vTab_on;
var vTab_off;
try {
if(document.getElementById(vTab_tabid[vTab_tabnumber-1])) {
vTab_on = document.getElementById('Tab_tab'+vTab_tabnumber);
vTab_off = document.getElementById('Tab_tab'+vTab_initTab);
vTab_on.className = 'Tab_tabon';
vTab_off.className = 'Tab_taboff';
vTab_initTab = vTab_tabnumber;
catch(vTab_err) { }

function fTab_mouseover(vTab_tabnumber) {
if(vTab_tabnumber==vTab_initTab) return false;
var vTab_mouseover;
try {
vTab_mouseover = document.getElementById('Tab_tab'+vTab_tabnumber);'hand';
catch(vTab_err) { }

function fTab_mouseout(vTab_tabnumber) {
if(vTab_tabnumber==vTab_initTab) return false;
var vTab_mouseout;
try {
vTab_mouseout = document.getElementById('Tab_tab'+vTab_tabnumber);'auto';
catch(vTab_err) { }


if i use the same code and script in 1.jsp it gives me the above error. Please help.
Thanks in advance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31551

The JavaScript code can't give you a Java stack overflow, so we know the error isn't there. I don't see anything in your JSP.

Is there any Java code or JSP tags in use in your JSP? Can you comment out lines of code until you get to one that causes the error to occur?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: tabs and subtabs