Results 1 to 2 of 2
  1. #1
    aiesha is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default HTTP Status 500 -

    When ever I run this code I get an error.....could someone help me?


    Java Code:
    <%@ page contentType="text/html;" language="java" import="java.sql.*" errorPage="" %>
    
    <html>
    <head>
    <title>Requests for new loan</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    
    
    <table width="701" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr> 
        <td height="75" colspan="2" valign="top"><img src="tit_pro_req.gif" width="665" height="75"></td>
        <td width="36">&nbsp;</td>
      </tr>
      <tr> 
        <td width="5" height="20">&nbsp;</td>
        <td width="660">&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="278">&nbsp;</td>
        <td colspan="2" valign="top"><table width="96%" border="1" cellpadding="0" cellspacing="0">
            <!--DWLayoutTable-->
            <tr> 
              <td colspan="6" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
            <tr> 
              <td width="47" valign="top"> <div align="center"><font color="#996600"><strong>ID</strong></font></div></td>
              <td width="142" valign="top"><div align="center"><strong><font color="#996600">Name</font></strong></div></td>
              <td width="143" valign="top"><div align="center"><strong><font color="#996600">Account 
                  Number </font></strong></div></td>
              <td width="186" valign="top"> <div align="center"><strong><font color="#996600">Email</font></strong></div></td>
              <td width="68" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
              <td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
            <tr> 
              <td colspan="6" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
            <% 
    		Connection con=null;
    		Statement smt=null;
    		ResultSet rs=null;
    		
    		try
    		{
    
    			Class.forName("com.mysql.jdbc.Driver");
    			con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ebanking","root","aiesha");
    		}
    		catch(ClassNotFoundException ce){	out.print("<p>&nbsp;</p><p align=center><strong><font color=#CC3300>");
    											out.print("Check the values and try again...");
    											out.print("</font></strong></p>");}
    		catch(SQLException ce){		out.print("<p>&nbsp;</p><p align=center><strong><font color=#CC3300>");
    									out.print("Check the values and try again...");
    									out.print("</font></strong></p>");}
    
    		smt=con.createStatement();
    		String query=new String("select name,acc_no,email,lid from loan_appln where sta=1");
    		rs=smt.executeQuery(query);
    		boolean ne=rs.next();
    		int idu=0;
    		if (ne)
    		{
    			idu=rs.getInt(4);
    			session.setAttribute("id1",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=1"> 
                  <% out.print(idu); %>
                  </a></div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=1"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"> </div></td>
                
    		<form name="f1" action="ad_ser_loan_last.jsp?id=1&pro=1" method="post">
              <td valign="top"><div align="center">
    		<input type="submit" name="Submit" value="Accept">
                </div></td>
    			</form>
    			<form name="f11" action="ad_ser_loan_last.jsp?id=1&pro=2"  method="post">
              <td valign="top"><div align="center"> 
                  <input type="submit" name="Submit2" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id2",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=2" > 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=2" > 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f2" action="ad_ser_loan_last.jsp?id=2&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit3" value="Accept">
                </div></td>
    			</form><form name="f12" action="ad_ser_loan_last.jsp?id=2&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit5" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id3",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=3"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center">  <a href="ad_req_loan_ser.jsp?id=3"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f3" action="ad_ser_loan_last.jsp?id=3&pro=1" method="post">
              <td valign="top"><div align="center"> 
                    <input type="submit" name="Submit4" value="Accept">
                </div></td>
    			</form><form name="f13" action="ad_ser_loan_last.jsp?id=3&pro=2" method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit6" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id4",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=4"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center">  <a href="ad_req_loan_ser.jsp?id=4"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f4" action="ad_ser_loan_last.jsp?id=4&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit7" value="Accept">
                </div></td>
    			</form><form name="f14" action="ad_ser_loan_last.jsp?id=4&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit8" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id5",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=5"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=5"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f5" action="ad_ser_loan_last.jsp?id=5&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit9" value="Accept">
                </div></td>
    			</form><form name="f15" action="ad_ser_loan_last.jsp?id=5&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit10" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id6",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=6"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=6"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f6" action="ad_ser_loan_last.jsp?id=6&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit11" value="Accept">
                </div></td>
    			</form><form name="f16" action="ad_ser_loan_last.jsp?id=6&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit12" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id7",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=7"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=7"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f7" action="ad_ser_loan_last.jsp?id=7&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit13" value="Accept">
                </div></td>
    			</form><form name="f17" action="ad_ser_loan_last.jsp?id=7&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit14" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id8",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=8"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=8"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f8" action="ad_ser_loan_last.jsp?id=8&pro=1"  method="post">
              <td valign="top"><div align="center"> 
                    <input type="submit" name="Submit15" value="Accept">
                </div></td>
    			</form><form name="f18" action="ad_ser_loan_last.jsp?id=8&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input type="submit" name="Submit16" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id9",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=9"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center"> <a href="ad_req_loan_ser.jsp?id=9"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f9" action="ad_ser_loan_last.jsp?id=9&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit17" value="Accept">
                </div></td>
    			</form><form name="f19" action="ad_ser_loan_last.jsp?id=9&pro=2"  method="post">
              <td valign="top"><div align="center"> 
                  <input type="submit" name="Submit18" value="Reject">
                </div></td></form>
            </tr>
            <%
    		ne=rs.next();
    		if(ne)
    		{
    		idu=rs.getInt(4);
    		session.setAttribute("id10",String.valueOf(idu));
    		%>
            <tr> 
              <td valign="top"> <div align="center"> <a href="ad_req_loan_ser.jsp?id=10"> 
                  <% out.print(idu); %>
                  </a> </div></td>
              <td valign="top"><div align="center">  <a href="ad_req_loan_ser.jsp?id=10"> 
                  <% out.print(rs.getString(1)); %></a>
                </div></td>
              <td valign="top"><div align="center"> 
                  <% out.print(rs.getString(2)); %>
                </div></td>
              <td valign="top"> <div align="center"> 
                  <% out.print(rs.getString(3)); %>
                </div>
                <div align="center"></div></td>
    			<form name="f10" action="ad_ser_loan_last.jsp?id=10&pro=1"  method="post">
              <td valign="top"><div align="center">
    <input type="submit" name="Submit19" value="Accept">
                </div></td>
    			</form><form name="f20" action="ad_ser_loan_last.jsp?id=10&pro=2"  method="post">
              <td valign="top"><div align="center">
                  <input name="Submit20" type="submit" id="Submit20" value="Reject">
                </div></td></form>
            </tr>
            <tr> 
              <td height="2"></td>
              <td></td>
              <td></td>
              <td colspan="2"></td>
              <td width="68"></td>
            </tr>
            <%
    		}
    		}
    		}
    		}
    		}
    		}
    		}
    		}
    		}
    		%>
          </table></td>
      </tr>
      <tr>
        <td height="47">&nbsp;</td>
        <td><% }
    			else
    			{
    				out.print("<p>&nbsp;</p><p align=center><strong><font color=#CC3300>");
    				out.print("No new requests...");
    				out.print("</font></strong></p>");
    			}
    		%></td>
        <td></td>
      </tr>
    </table>
    <%
    	if (con!=null)
    	{
    		smt.close();
    		con.close();
    	}
    %>
    </body>
    </html>
    This is the error that I get

    Java Code:
    HTTP Status 500 - 
    
    --------------------------------------------------------------------------------
    
    type Exception report
    
    message 
    
    description The server encountered an internal error () that prevented it from fulfilling this request.
    
    exception 
    
    org.apache.jasper.JasperException: An exception occurred processing JSP page /ad_new_loan_req.jsp at line 62
    
    59: 
    60: 		smt=con.createStatement();
    61: 		String query=new String("select name,acc_no,email,lid from loan_appln where sta=1");
    62: 		rs=smt.executeQuery(query);
    63: 		boolean ne=rs.next();
    64: 		int idu=0;
    65: 		if (ne)
    
    
    Stacktrace:
    	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    
    
    root cause 
    
    javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'sta' in 'where clause'
    	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
    	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    	org.apache.jsp.ad_005fnew_005floan_005freq_jsp._jspService(ad_005fnew_005floan_005freq_jsp.java:571)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    
    
    root cause 
    
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'sta' in 'where clause'
    	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	java.lang.reflect.Constructor.newInstance(Unknown Source)
    	com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    	com.mysql.jdbc.Util.getInstance(Util.java:384)
    	com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
    	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
    	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
    	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
    	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
    	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
    	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2512)
    	com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1476)
    	org.apache.jsp.ad_005fnew_005floan_005freq_jsp._jspService(ad_005fnew_005floan_005freq_jsp.java:116)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    
    
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
    
    
    --------------------------------------------------------------------------------
    
    Apache Tomcat/6.0.26

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Please do yourself a favour and stop writing java code in JSPs. Use JSPs for presentation only and put processing logic in servlets and helper classes.
    Also pay more attention to your error messages, The message says that you don't have a column called sta on the table called loan_appln, that means you can't do "select name,acc_no,email,lid from loan_appln where sta=1".

Similar Threads

  1. http://localhost:8080/helloservice/HelloService?Tester HTTP Status 404 -
    By vietnamusa in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 03-13-2011, 01:02 AM
  2. web app not working HTTP 404 status
    By ShinTec in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 01-31-2011, 04:02 PM
  3. HTTP Status 500 -
    By gardiann in forum Java Servlet
    Replies: 2
    Last Post: 12-26-2010, 01:49 PM
  4. http status 500
    By swathi dharmaraj in forum Java Servlet
    Replies: 4
    Last Post: 12-14-2010, 05:46 PM
  5. Replies: 7
    Last Post: 11-11-2009, 09:29 PM

Posting Permissions

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