Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tabs and subtabs

 
gurudev arer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

ERROR:
=====
javax.servlet.ServletException: java.lang.StackOverflowError
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:274)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

The JSP page and the JAVA SCRIPT is below

HTML(JSp):
=======
[code=java]
<HTML>
<HEAD>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/Tabs.js"></script>
<link href="<%=request.getContextPath()%>/css/subtabs.css" rel="stylesheet" type="text/css" />
</HEAD>
<BODY>
<center>
<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">
<tr>
<td>
<script type="text/javascript">
vTab_initTab = 1; // initialize with tab #1 selected.
Tab('tab1','TAB 1','tab2','TAB 2','tab3','TAB 3');
</script>
</td>
<tr>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>

[/code]

JAVASCRIPT :
=========
[code=java]
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>');
document.write('</table>');

for(vTab_i=-2;(vTab_i+2)<vTab_args;vTab_i+=2) {
if((((vTab_i+2)/2)+1)==vTab_initTab) {
try {
document.getElementById('Tab_content').innerHTML=document.getElementById(arguments[(vTab_i+2)]).innerHTML;
break;
}
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])) {
fTab_mouseout(vTab_tabnumber);
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';
document.getElementById(vTab_tabid[vTab_initTab-1]).innerHTML=document.getElementById('Tab_content').innerHTML;
document.getElementById('Tab_content').innerHTML=document.getElementById(vTab_tabid[vTab_tabnumber-1]).innerHTML;
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);
vTab_mouseover.style.cursor='hand';
vTab_mouseover.className='Tab_tabmouseover';
}
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);
vTab_mouseout.style.cursor='auto';
vTab_mouseout.className='Tab_taboff';
}
catch(vTab_err) { }
}

[/code]

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
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurudev,
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic