strange compilation error
I am using two combination
1. Apache 5.5.23 with jdk 1.5
2. Apache 5.0.28 with jdk 1.4
in my application a JSP page is running perfactly fine with combination 1.
but in combination 2 it is showing compilation error........
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:30:'try' without'catch' or'finally'
try{
^
An error occurred at line: 336 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:383:'else' without'if'
elseif(i==13 && j!=1 && j!=10 && j!=11 && j!=29 && j!=30)
^
An error occurred at line: 362 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:411: illegal start of type
if(i==14 ){
^
An error occurred at line: 366 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:416: <identifier> expected
out.println("</TR>");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:421:'class' or'interface' expected
out.write("\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:422:'class' or'interface' expected
out.write(" </TABLE>\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:423:'class' or'interface' expected
out.write("....................................
\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:424:'class' or'interface' expected
out.write("\r\n"
);
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:425:'class' or'interface' expected
out.write("<INPUT type=\"button\" value=\"-Submit\" Id=\"B1\" onClick=\"submt();\" >\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:426:'class' or'interface' expected
out.write("
\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:427:'class' or'interface' expected
out.write("</FORM>\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:428:'class' or'interface' expected
out.write("<a href=\"../Login/logout.jsp\">LOGOUT</a>
\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:429:'class' or'interface' expected
out.write("</BODY>\r\n");
^
An error occurred at line: 370 in the jsp file: /right/ipc1.jsp
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:430:'class' or'interface' expected
out.write("</HTML>\r\n");
^
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:431:'class' or'interface' expected
}catch (Throwable t){
^
Generated servlet error:
/tomcat/appsrv/work/crimeonline/crimeonline/_/org/apache/jsp/right/ipc1_jsp.java:443:'class' or'interface' expected
please if anyone know the possible reason .....and what measure should i take to avoid this error ,pls help me.
thank
uday
[6026 byte] By [
hunterzza] at [2007-11-27 11:48:41]

# 3
here it is ipc1.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content= "text/html; charset=us-ascii">
<TITLE>uday</TITLE>
<LINK rel="SHORTCUT ICON" href="../all/favicon.ico">
<link rel="stylesheet" href="../all/estilos.css" type="text/css">
<SCRIPT language="JavaScript" type="text/javascript">
window.history.forward(1);
</SCRIPT>
</HEAD>
<BODY ><pre>
<a href="../Login/after_login.jsp">HOME</a> <a href="ipc1.jsp">REFRESH</a> </pre>
<H3 align="center">IPC Page 1</H3>
<%
int rows=28;
int cols=30;
int i = 0;
int j = 0;
int temp[][] = new int[rows+1][cols+1];
if(session.getAttribute("district")==null || session.getAttribute("jsp_name")==null || session.getAttribute("super")!=null )
response.sendRedirect("../errors/session_exp.jsp");
else if(session.getAttribute("jsp_name")!=null&& !session.getAttribute("jsp_name").equals("ipc1"))
{
response.sendRedirect("../errors/session_exp.jsp");
}
else
{
String district = (String) session.getAttribute("district");
String mon = (String) session.getAttribute("month");
String yr = (String) session.getAttribute("year");
String month[] = { "January","Febrary","March","April","May","June","July","Augest","September","October","November","December"};
out.print("<h4>'"+district+"'"+month[Integer.parseInt(mon)]+"/"+yr+"</h4>" );
Connection connect;
connect=null;
try{// Create a OracleDataSource instance
OracleDataSource ods = new OracleDataSource();
//url
ods.setURL("some url");
//user
ods.setUser("some user");
// Sets the password
ods.setPassword("some password");
connect = ods.getConnection();
}catch (Exception e){
out.print(e);
}
Statement statement = null;
ResultSet rs = null;
String query = null;
for( i=1;i<=rows;i++)
for( j=1;j<=cols;j++)
{
try{
statement = connect.createStatement();
query = "SELECT VALUE FROM TEMP_"+session.getAttribute("district")+" WHERE FIELD = 'v"+i+"_"+j+"'";
rs = statement.executeQuery(query);
rs.next();
query = rs.getString(1);
if(query.equals("999999"))
temp[i][j]=0;
else
temp[i][j]=Integer.parseInt(rs.getString(1));
if(rs!=null)
rs.close();
if(statement!=null)
statement.close();
//// System.out.println("d"+i+"_"+j+"--"+temp[i][j]);
}catch (Exception e) {
if(rs!=null)rs.close();
if(statement!=null)statement.close();
out.println(" cac.jsp -->Exception in retrieving data from TEMP table ##### "+e);
}
}
if(connect!=null)connect.close();
}
%>
<SCRIPT type="text/javascript">
// JavaScript Document
window.history.forward(1);
function submt()
{
var x = confirm('Do you want to continue on to this page?');
if(x == true)
{
window.location="../save/ipc1.jsp";
}
else
{
return;
}
}
function send(i,j)
{
var req;
req = false;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest && !(window.ActiveXObject))
{
try {
req = new XMLHttpRequest();
} catch(e) {
alert("Not supported for XMLHttpRequest();");
req = false;
}
// branch for IE/Windows ActiveX version
}
else if(window.ActiveXObject)
{
try {
// ...otherwise, use the ActiveX control for IE5.x and IE6
req = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e) {
alert("Msxml2.XMLHTTP");
req = false;
}
}
if(req) {
//req.onreadystatechange = processReqChange;
//if((req.readyState==4) && (req.status == 200))
{
if(isNaN(document.getElementById("v"+i+"_"+j).value)||document.getElementById("v"+i+"_"+j).value=="")
{ <!--alert("WARNINNG!! ONLY INTEGERS ARE ALLOWED DO NOT TRY TO ENTER NON NUMERIC CHARACTERS");-->
y = 0;
document.getElementById("v"+i+"_"+j).value=0;
}
else
y = document.getElementById("v"+i+"_"+j).value;
req.open('GET', '../AJaction/ajax.jsp?vr='+y+'&i='+i+'&j='+j, true);
req.send("");
}
}
else{ alert("something wrong");
}
if(j==2||j==3||j==4||j==5||j==6||j==8)
check_10(i,j);
else if(j==13||j==14||j==15||j==16||j==17)
check_30(i);
else if(j==8||j==19)
check_29(i);
else if(j==12)
check_11(i);
total_13(i,j);
total_27(i,j);
}
function check_10(i,j)
{
var v=0;
for(k=2;k<=8;k++)
{ if(k!=7)
{
v=v+parseInt(document.getElementById("v"+i+"_"+k).value,10);
}
}
document.getElementById("v"+i+"_10").value = parseInt(document.getElementById("h"+i+"_10").value,10)-v;
if(j!=8)
check_30(i);
}
function check_30(i)
{
var v=0;
for(j=2;j<=6;j++)
{
v=v+parseInt(document.getElementById("v"+i+"_"+j).value,10);
}
for(j=13;j<=17;j++)
{
v=v+parseInt(document.getElementById("v"+i+"_"+j).value,10);
}
document.getElementById("v"+i+"_30").value = v - parseInt(document.getElementById("h"+i+"_30").value,10);
}
function check_29(i)
{
var v=parseInt(document.getElementById("v"+i+"_19").value,10)+parseInt(document.getElementById("v"+i+"_8").value,10);
document.getElementById("v"+i+"_29").value= v- parseInt(document.getElementById("h"+i+"_29").value,10);
}
function check_11(i)
{
document.getElementById("v"+i+"_11").value= parseInt(document.getElementById("h"+i+"_11").value,10)
+parseInt(document.getElementById("v"+i+"_12").value,10);
}
function total_13(i,j)
{
var v =0 ;
for(i=1;i<13;i++)
v= v+ parseInt(document.getElementById("v"+i+"_"+j).value,10);
document.getElementById("v13_"+j).value= v + parseInt(document.getElementById("h13_"+j).value,10);
if(j==2||j==3||j==4||j==5||j==6||j==8)
check_10(13,j);
else if(j==13||j==14||j==15||j==16||j==17)
check_30(13);
else if(j==8||j==19)
check_29(13);
else if(j==12)
check_11(13);
}
function total_27(i,j)
{
var v =0 ;
for(i=15;i<27;i++)
v= v+ parseInt(document.getElementById("v"+i+"_"+j).value,10);
document.getElementById("v27_"+j).value= v + parseInt(document.getElementById("h27_"+j).value,10);
if(j==2||j==3||j==4||j==5||j==6||j==8)
check_10(27,j);
else if(j==13||j==14||j==15||j==16||j==17)
check_30(27);
else if(j==8||j==19)
check_29(27);
else if(j==12)
check_11(27);
}
</SCRIPT>
<FORM name="form1" >
<TABLE border="1">
<TR>
<TH rowspan="3">S.No</TH>
<TH rowspan="3">Head of Crime</TH>
<TH colspan="10">Previous Year</TH>
<TH colspan="12">Year under review.</TH>
<TH colspan="4">Disposal by Court (in Year Under
Review)</TH>
<TH colspan="2">Value of the Property</TH>
<TH colspan="2">Disposed of in the Month (No Matter
Whenever Registered )</TH>
</TR>
<TR>
<TH rowspan="2">Pending from Previous
Years</TH>
<TH colspan="7">Disposal</TH>
<TH rowspan="2">Number of Persons
Arrested</TH>
<TH rowspan="2">Pending Investigation</TH>
<TH colspan="2">Registration</TH>
<TH colspan="7">Disposal</TH>
<TH rowspan="2">Number of Persons
Arrested</TH>
<TH colspan="2">Pending Investigation</TH>
<TH rowspan="2">Convicted</TH>
<TH rowspan="2">Acquittal/ Discharged</TH>
<TH rowspan="2">Compounded/ Withdrawn</TH>
<TH rowspan="2">Pending Trial</TH>
<TH rowspan="2">Stolen</TH>
<TH rowspan="2">Recovered</TH>
<TH rowspan="2">Total Chargesheeted</TH>
<TH rowspan="2">Total F.R.</TH>
</TR>
<TR>
<TH >157-B</TH>
<TH >Unoccurred ( False )</TH>
<TH >Unoccurred ( Others )</TH>
<TH >Untraced</TH>
<TH >For want of evidence</TH>
<TH >299 Cr. P.C.</TH>
<TH >Total Chargesheeted (Including those
under 299 Cr.P.C.)</TH>
<TH >Registered in the year</TH>
<TH >Registered in the month</TH>
<TH >157-B</TH>
<TH >Unoccurred ( False )</TH>
<TH >Unoccurred ( Others )</TH>
<TH >Untraced</TH>
<TH >For want of evidence</TH>
<TH >299 Cr. P.C.</TH>
<TH >Total Chargesheeted (Including those
under 299 Cr.P.C.)</TH>
<TH >Less than 3 Months</TH>
<TH >Over 3 Months</TH>
</TR>
<TR>
<TH>1</TH>
<TH>Murder(Sec 302/303 I.P.C)</TH>
<TD colspan="30"></TD>
</TR>
<%@page import="java.sql.*"%>
<%@page import="oracle.jdbc.pool.OracleDataSource"%>
<%
for( i=1; i<=rows; i++) {
out.println("<TR>");
if(i==1) out.println("<th> 1.1 </th> <th> For Gain</th>");
if(i==2) out.println("<th> 1.2 </th> <th>Over Property Dispute</th>");
if(i==3) out.println("<th> 1.3 </th> <th> Due to Personal Vendetta or Enmity</th>");
if(i==4) out.println("<th> 1.4 </th> <th> Due to Love Intrigue</th>");
if(i==5) out.println("<th> 1.5 </th> <th> For Dowry</th>");
if(i==6) out.println("<th> 1.6 </th> <th> Due to Communalism</th>");
if(i==7) out.println("<th> 1.7 </th> <th> Due to Casteism</th>");
if(i==8) out.println("<th> 1.8 </th> <th> For Witchcraft</th>");
if(i==9) out.println("<th> 1.9 </th> <th> For Human Sacrifice</th>");
if(i==10) out.println("<th> 1.10 </th> <th> By Terrorists/Extremists</th>");
if(i==11) out.println("<th> 1.11 </th> <th> For Political reasons</th>");
if(i==12) out.println("<th> 1.12 </th> <th>Due to Other Causes</th>");
if(i==13) out.println("<th> 1.13 </th> <th> TOTAL(Murder)</th>");
if(i==14) out.println("<th> 2 </th> <th> Attempt to Murder (Sec.107 I.P.C.) </th>");
if(i==15) out.println("<th> 3.1 </th> <th> For Gain</th>");
if(i==16) out.println("<th> 3.2 </th> <th>Over Property Dispute</th>");
if(i==17) out.println("<th> 3.3 </th> <th nowrap='nowrap'> Due to Personal Vendetta or Enmity</th>");
if(i==18) out.println("<th> 3.4 </th> <th> Due to Love Intrigue</th>");
if(i==19) out.println("<th> 3.5 </th> <th> For Dowry</th>");
if(i==20) out.println("<th> 3.6 </th> <th> Due to Communalism</th>");
if(i==21) out.println("<th> 3.7 </th> <th> Due to Casteism</th>");
if(i==22) out.println("<th> 3.8 </th> <th> For Witchcraft</th>");
if(i==23) out.println("<th> 3.9 </th> <th> For Human Sacrifice</th>");
if(i==24) out.println("<th> 3.10 </th> <th> By Terrorists/Extremists</th>");
if(i==25) out.println("<th> 3.11 </th> <th> For Political Reasons</th>");
if(i==26) out.println("<th> 3.12 </th> <th>Due to Other Causes</th>");
if(i==27) out.println("<th> 3.13 </th> <th> TOTAL(C.H.) not amounting to murder</th>");
if(i==28) out.println("<th> 4 </th> <th> Rape(Sec.376 I.P.C.) </th>");
for( j=1; j<=cols; j++)
{
if(j==1)
{
out.println("<td><input type=text size=5 value="+temp[i][j]
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(j==10)
{
int r=0,sum = 0;
// CASE :- when i=13 & j=10 (both read-only)
if(i==13)
{
sum=0;
for(r=1;r<=12;r++)
{
sum=sum+(temp[r][1]-(temp[r][2]+temp[r][3]+temp[r][4]+temp[r][5]+temp[r][6]+temp[r][8]));
}
}
// CASE :- when i=28 & j=10 (both read-only)
else if(i==27)
{
sum=0;
for(r=15;r<=26;r++)
{
sum=sum+(temp[r][1]-(temp[r][2]+temp[r][3]+temp[r][4]+temp[r][5]+temp[r][6]+temp[r][8]));
}
}
// CASE :- when j=10 (BUT EXCEPT cells of type : read-only)
else
{
sum=0;
sum = (temp[i][1]-(temp[i][2]+temp[i][3]+temp[i][4]+temp[i][5]+temp[i][6]+temp[i][8])) ;
}
out.println("<td><input type=text size=5 value="+sum+" onchange='send("+i+","+j+");' MAXLENGTH=5Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(j==11)
{
int r=0,sum = 0;
// CASE :- when i=13 & j=11 (both read-only)
if(i==13)
{
sum=0;
for(r=1;r<=12;r++)
{
sum=sum+(temp[r][11]+temp[r][12]);
}
}
else if(i==27) // CASE :- when i=28 & j=11 (both read-only)
{
sum=0;
for(r=15;r<=26;r++)
{
sum=sum+(temp[r][11]+temp[r][12]);
}
}
else// CASE :- when j=11 (BUT EXCEPT cells of type : read-only)
{
sum=0;
sum = temp[i][11]+temp[i][12] ;
}
out.println("<td><input type=text size=5 value="+sum
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(j==29)
{
int r=0,sum = 0;
// CASE :- when i=13 & j=29 (both read-only)
if(i==13)
{
sum=0;
for(r=1;r<=12;r++)
{
sum=sum+(temp[r][8]+temp[r][19]-temp[r][29]);
}
}
else if(i==27) // CASE :- when i=28 & j=29 (both read-only)
{
sum=0;
for(r=15;r<=26;r++)
{
sum=sum+(temp[r][8]+temp[r][19]-temp[r][29]);
}
}
// CASE :- when j=29 (BUT EXCEPT cells of type : read-only)
else
{
sum=0;
sum = temp[i][8]+temp[i][19]-temp[i][29] ;
}
out.println("<td><input type=text size=5 value="+sum
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(j==30)
{
int r=0,sum = 0;
// CASE :- when i=13 & j=30 (both read-only)
if(i==13)
{
sum=0;
for(r=1;r<=12;r++)
{
sum=sum+temp[i][2]+temp[r][3]+temp[r][4]+temp[r][5]+temp[r][6]+temp[r][13]
+temp[r][14]+temp[r][15]+temp[r][16]+temp[r][17]-temp[r][30];
}
}
// CASE :- when i=28 & j=30 (both read-only)
else if(i==27)
{
sum=0;
for(r=15;r<=26;r++)
{
sum=sum+temp[i][2]+temp[r][3]+temp[r][4]+temp[r][5]+temp[r][6]+temp[r][13]
+temp[r][14]+temp[r][15]+temp[r][16]+temp[r][17]-temp[r][30];
}
}// CASE :- when j=30 (BUT EXCEPT cells of type : read-only)
else
{
sum=0;
sum = temp[i][2]+temp[i][3]+temp[i][4]+temp[i][5]+temp[i][6]+temp[i][13]
+temp[i][14]+temp[i][15]+temp[i][16]+temp[i][17]-temp[i][30] ;
}
out.println("<td><input type=text size=5 value="+sum
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(i==13 && j!=1 && j!=10 && j!=11 && j!=29 && j!=30)
{
out.println("<td><input type=text size=5 value="+(temp[1][j]+temp[2][j]
+temp[3][j]+temp[4][j]+temp[5][j]+temp[6][j]+temp[7][j]+temp[8][j]+temp[9][j]+temp[10][j]
+temp[11][j]+temp[12][j])
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else if(i==27 && j!=1 && j!=10 && j!=11 && j!=29 && j!=30)
{
out.println("<td><input type=text size=5 value="+(temp[15][j]+temp[16][j]+temp[17][j]+temp[18][j]
+temp[19][j]+temp[20][j]+temp[21][j]+temp[22][j]+temp[23][j]+temp[24][j]
+temp[25][j]+temp[26][j])
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" readonly></td>");
out.println("<input type=hidden value='"+temp[i][j]+"' Id=h"+i+"_"+j+" readonly >");
}
else
{
out.println("<td><input type=text size=5 value="+temp[i][j]
+" onchange='send("+i+","+j+");' MAXLENGTH=5 Id=v"+i+"_"+j+" ></td>");
}
}
if(i==14 ) {
out.println("</tr> <tr><th> 3 </th> <th>Culpable Homicide</th>");
}
out.println("</TR>");
}
%>
</TABLE>
....................................
<INPUT type="button" value="-Submit" Id="B1" onClick="submt();" >
</FORM>
<a href="../Login/logout.jsp">LOGOUT</a>
</BODY>
</HTML>