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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "tabs and subtabs" Watch "tabs and subtabs" New topic
Author

tabs and subtabs

gurudev arer
Greenhorn

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

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

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?


[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: http://aspose.com/file-tools
 
subject: tabs and subtabs