Results 1 to 6 of 6
Thread: Error in jsp
- 03-22-2012, 08:09 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
Error in jsp
<%@ page import="java.sql .*" %>
<%@ page import="java.util .*" %>
<%@ include file="../Common/dbts.jsp" %>
<%@ include file="../Common/getDatabaseConnection.jsp" %>
<% String sid = request.getParameter("sid").toUpperCase().trim();% >
<%
int sid_number =0;
sid_number = Integer.parseInt(request.getParameter("sid_number" ));
int sl_no = 0;
sl_no = Integer.parseInt(request.getParameter("sl_no"));
String enableFlag =null;
enableFlag = request.getParameter("flag").trim();
String enableFlagValue = null;
String bol = null;
Vector id=new Vector();
String ids="";
if(null != enableFlag && !"".equals(enableFlag.trim()))
{
if(enableFlag.equalsIgnoreCase("Y"))
{
bol= "true";
enableFlagValue="ENABLE";
}
else
{
bol="false";
enableFlagValue="DISABLE";
}
}
if (!sid.equals("") && sid!=null ) {
Connection conn1 = dbts.getConnection();
Connection conn2 = getDatabaseConnection(conn1,sid);
conn1.close();
String sql1="execute DBMS_SYSTEM.set_sql_trace_in_session("+sid_number+ ", "+sl_no+",'"+bol+"');";
String sql3="commit";
PreparedStatement stmt1 = conn2.prepareStatement(sql1);
stmt1.executeUpdate();
PreparedStatement stmt3 = conn2.prepareStatement(sql3);
stmt3.executeUpdate();
conn2.close();
}
%>
<jsp:forward page="datasid11.jsp"/>
The error msg is: Servelet error:An exception occured. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.
Here i hav to enable trace. i have passed sid= database name, sid_number, serial#,flag; Pls help me and put it in most common words as i'm new to all this.
- 03-22-2012, 10:15 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Error in jsp
That's easy.
Don't do this in a JSP page.
This is entirely servlet based code, with the database stuff in a DataAccessObject called by the servlet.
The servlet then does the forwarding.
That would, of course, also include getting rid of those database related JSPs.
This is something of an abuse of JSPs, which should only really be used for displaying the results of processing done by servlets.Please do not ask for code as refusal often offends.
- 03-22-2012, 10:15 AM #3
Member
- Join Date
- May 2011
- Posts
- 27
- Rep Power
- 0
Re: Error in jsp
Connection conn1 = dbts.getConnection();
Connection conn2 = getDatabaseConnection(conn1,sid); //connection2 is reffering the connection1 object .
conn1.close(); // your are closing the conn1 and executing the statments so that the exception will occure.
Dont close the conn1 until conn2 execution if finished.
- 03-22-2012, 10:51 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Error in jsp
How do you know what is going on inside the getDatabaseConnection() method?
There's no code up there showing what is happening in there.
conn1 and conn2 may be completely unrelated.Please do not ask for code as refusal often offends.
- 03-22-2012, 11:09 AM #5
Member
- Join Date
- May 2011
- Posts
- 27
- Rep Power
- 0
Re: Error in jsp
Instanced of creating the new object they are using the existing connection object instance only. As normal we use.
this may be one case. Their may chance any another cases to occur a problem .
If he prints the getDatabaseConnection class then it will more clear to clarify the problem.
- 03-22-2012, 11:26 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Error in jsp
Then I would question what on earth the point is of this code.
Why create a connection from another connection like this?
Then again, until they sort out where they are doing this code and move it to where it belongs (out of the JSP entirely) I have little intention of looking further into it.Please do not ask for code as refusal often offends.
Similar Threads
-
java out of memory error-heap space error
By elsanthosh in forum NetBeansReplies: 4Last Post: 06-15-2010, 09:31 AM -
> Operator cannot be applied error and return incompatible types error
By corney_16 in forum New To JavaReplies: 1Last Post: 03-10-2010, 01:53 PM -
Thread: Error 500--Internal Server Error java.lang.NullPointerException
By jackdear44 in forum New To JavaReplies: 1Last Post: 12-05-2009, 07:28 AM -
java.lang.Error: Error opening DSound for capture
By NARs in forum NetworkingReplies: 1Last Post: 10-26-2009, 04:38 PM -
Diference Between compiler error Garbage collection and Runtime Error?
By makpandian in forum New To JavaReplies: 3Last Post: 01-23-2009, 08:53 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks