Results 1 to 6 of 6

Thread: Error in jsp

  1. #1
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default 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.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default 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.

  3. #3
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default 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.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default 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.

  5. #5
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default 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.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default 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

  1. java out of memory error-heap space error
    By elsanthosh in forum NetBeans
    Replies: 4
    Last Post: 06-15-2010, 09:31 AM
  2. Replies: 1
    Last Post: 03-10-2010, 01:53 PM
  3. Replies: 1
    Last Post: 12-05-2009, 07:28 AM
  4. Replies: 1
    Last Post: 10-26-2009, 04:38 PM
  5. Replies: 3
    Last Post: 01-23-2009, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •