• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

The program error!

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers.,
I'm doing a program in JSP and oracle and Apache Tomcat as the webserver. I'm doing this as my academic project in Cochin Shipyard.
Here for file opening.. i want to specify some fields!!
when i tried to run this page the webserver is going shut down..
i thought it was the problem with Tomcat and i changed to Sun's App Server
this also happened in Sun's Appserver

when ever i load this page.. this is happening..
i'm placing the code here.. please make a look thru this and tell me what the problem is

<%@ page language="java" session="true" import="java.sql.*" import="java.lang.*" %>
<%
String firstname = (String)session.getValue("firstname");
String lastname = (String)session.getValue("lastname");
Integer admin = (Integer)session.getValue("admin");
Integer status = (Integer)session.getValue("status");
String id = (String)session.getValue("id");

if(firstname==null || status==null || lastname==null || admin==null)
{
response.sendRedirect("../../../sessionout.htm");}
%>
<script language="javascript" type="text/javascript" src="../scripts/jscript.js">
</script>

<html xmlns:astutemedia>
<head>
<?import namespace="astutemedia" implementation="CalendarPopup.htc">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>New Page 1</title>
</head>
<LINK href="../../../css/stylesheet.css" type=text/css rel=stylesheet>

<body>
<%
try
{
try
{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{out.println(e);
}

String dbURL = "jdbc:odbc:Operations";

Connection dbCon;
dbCon = DriverManager.getConnection(dbURL,"ict","ict");
Statement stmt = dbCon.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String query1 = "Select masterfileno from seaimp.importfile order by masterfileno";
ResultSet rs = stmt.executeQuery(query1);
String fileno="";
rs.last();
fileno = rs.getString(1);
String last_values = fileno.substring(3,8);
int file_no = Integer.parseInt(last_values);
file_no = file_no + 1;
String new_file_no = String.valueOf(file_no);
String filno="";
if(file_no<=9999)
filno = "10.0" + new_file_no;
if(file_no>=10000 && file_no <= 99999)
filno = "10." + new_file_no;

%>
<form name="form1" onsubmit="validate();return false">
<table border="0" width="100%" id="table1">
<tr>
<td width="334" colspan="2">

<p><font color="#0052BA" size="2"><b>10 Series File Opening</b></font></p>
</td>
<td width="171"> </td>
<td width="463"><span style="font-size: 9pt; font-weight: 700">Fields
marked with </span><font size="4" color="#FF0000">
<span style="font-weight: 700">*</span></font><span style="font-size: 9pt; font-weight: 700">
are mandatory</span></td>
</tr>
<tr>
<td width="131"> </td>
<td width="203"> </td>
<td width="171"> </td>
<td width="463"> </td>
</tr>
<tr>
<td width="131"><b><font style="font-size: 9pt" face="Arial">File Number</font></b></td>
<td width="203"> <font color ="#005900" style="font-size: 9pt; font-weight: 700"><%=filno%></font></td>
<%
stmt.close();
%>
<td width="171"><b><font face="Arial" style="font-size: 9pt">TBL Number</font></b></td>
<td width="463"><font face="Arial" size="1">
<span style="font-size: 9pt"><input name="tbl" size="20"></span></font></td>
</tr>
<tr>
<td width="131"><b><font face="Arial" style="font-size: 9pt">Date</font></b></td>
<td width="203"><font face="Arial" size="1">
<span style="font-size: 9pt"><input name="date" size="20" readonly></span></font></td>
<td width="171"><b><font face="Arial" style="font-size: 9pt">CIF</font></b></td>
<td width="463"><font face="Arial" size="1">
<span style="font-size: 9pt"><input name="cif" size="20"></span></font></td>
</tr>
<tr>
<td width="131"><b><font face="Arial" style="font-size: 9pt">Office</font></b><font size="4" color="#FF0000"><span style="font-weight: 700">*</span></font></td>
<td width="203"><font face="Arial" size="1">
<span style="font-size: 9pt"><select size="1" name="office">
<option value="none" selected>--Select one--</option>
<%
String query2 = "Select * from seaimp.offices order by officename";
Statement stmt1 = dbCon.createStatement();
ResultSet rs1 = stmt1.executeQuery(query2);
while(rs1.next())
{String office_code = rs1.getString(1);
String office_name = rs1.getString(2);
%>
<option value="<%=office_code%>"><%=office_name%></option>
<%}
rs1.close();
stmt1.close();
%>
</select></span></font></td>
<td width="171"><b><font face="Arial" style="font-size: 9pt">Message Ref</font></b></td>
<td><font face="Arial" size="1"><span style="font-size: 9pt">
<input name="msgref" size="20"></span></font></td>
</tr>
<tr>
<td width="131"><b><font face="Arial" style="font-size: 9pt">File Type</font></b><font size="4" color="#FF0000"><span style="font-weight: 700">*</span></font></td>
<td width="203"><font face="Arial" size="1">
<span style="font-size: 9pt"><select size="1" name="filetype">
<option selected value="none">--Select One--</option>
<%
String query3 = "Select * from seaimp.filetype order by filetype";
Statement stmt2 = dbCon.createStatement();
ResultSet rs2 = stmt2.executeQuery(query3);
while(rs2.next())
{String file_type = rs2.getString(1);
String file_desc = rs2.getString(2);
%>
<option value="<%=file_type%>"><%=file_desc%></option>
<%}
rs2.close();
stmt2.close();
%>


</select></span></font></td>
<td width="171"><b><font face="Arial" style="font-size: 9pt">Message
Date</font></b></td>
<td>
<font face="Arial" size="1"><span style="font-size: 9pt">
<input class="FormTextBox" id="Date1" maxlength="10" name="Date1" size="20" readonly></span></font><font face="Arial" style="font-size: 9pt"><b>
</b></font>
<astutemedia:calendar id="Calendar1" target="Date1"></astutemedia:calendar></td>
</tr>
<tr>
<td width="131"><b><font face="Arial" style="font-size: 9pt">Principal</font></b><font size="4" color="#FF0000"><span style="font-weight: 700">*</span></font></td>
<td width="203"><select size="1" name="principal">
<option selected value="none">--Select One--</option>
<%
String query4 = "Select * from seaimp.principal order by principalcode";
Statement stmt3 = dbCon.createStatement();
ResultSet rs3 = stmt3.executeQuery(query4);
while(rs3.next())
{String p_code = rs3.getString(1);
String p_name = rs3.getString(2);
%>
<option value="<%=p_code%>"><%=p_name%></option>
<%}
rs3.close();
stmt3.close();
%>
</select></td>
<td width="171"><b><font face="Arial" style="font-size: 9pt">Mombasa Ref</font></b></td>
<td><font face="Arial" size="1"><span style="font-size: 9pt">
<input name="mombassa" size="20"></span></font></td>
</tr>
<tr>
<td width="131"><b><font face="Arial" style="font-size: 9pt">Principal
Ref</font></b></td>
<td width="203"><font face="Arial" size="1">
<span style="font-size: 9pt"><input name="pref" size="20"></span></font></td>
<td width="171"><b><font face="Arial" style="font-size: 9pt">Other
Reference</font></b></td>
<td><font face="Arial" size="1"><span style="font-size: 9pt">
<input name="other" size="20"></span></font></td>
</tr>
<tr>
<td width="131"> </td>
<td width="203"> </td>
<td width="638" colspan="2">
 </td>
</tr>
<tr>
<td width="131"> </td>
<td width="378" colspan="2">
<p align="center">
<input type="submit" value="Add New" name="B1"></td>
<td width="463">
 </td>
</tr>
<tr>
<td width="131"> </td>
<td width="203"> </td>
<td width="638" colspan="2">
 </td>
</tr>
</table>
</form>
<%
dbCon.close();
}
catch(SQLException e)
{out.println(e);
}
%>

</body>
</html>


u can copy this code and see the layout..
please help me ranchers..

my team is telling the server is over loaded.. that is the problem..
and i don't think so..

please help me.. ranchers..

thanks in advance
regards
Sonu
[ June 19, 2006: Message edited by: Bear Bibeault ]
 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two problems with putting lots of Java code into a JSP like that:

1. There is a lot of HTML that prevents you from seeing what the Java code is.

2. There is a lot of Java code that prevents you from seeing what the HTML is.

So what I would suggest is, extract the Java code from that JSP. Run it as a standalone Java application and see what the problems are.
 
Message for you sir! I think it is a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic