0

friends i got problem in connection between oracle and jsp as given in cracking codes in j2me
in following codes

<?xml version="1.0"?>
<jsp:root xmlns:jsp="http://java.sun.com/products/jsp/dtd/jsp_1_0.dtd">
<main>
<title>Branch Info</title>


<%Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");%>


<%java.sql.connection db=java.sql.DriverManager.getConnecton("jdbc:odbc:master","sa","amrit");%>


<%java.sql.Statement st=db.createStatement();%>
<%java.sql.ResultSet rs;%>


<%rs=st.executeQuery("select item_code,quantity,unit_price form stock_mast;");%>
<%while(rs.next(()){%>
<%String name=rs.getString("item_code");%>
<%int aId=rs.getInt("quantity");%>
<%int uPrice=rs.getInt("unit_price");%>


<item_code><%=name%><quantity><%=aId%></quantity><unit_price><%=uPrice%></unit_price></item_code>


<%} %>


<%rs.close();%>


</main>
</jsp:root>

the error is

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: /mobilecommerce/jsp/sql_xml.jsp(2,5) Invalid standard action
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1249)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1559)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

Help me please this is my major project of college and i have only 3 days left to submit

Edited by happygeek: fixed formatting

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by jwenting
0

1) don't do business logic (which includes database access) from JSPs
2) don't use the JDBC-ODBC bridge driver
3) close ALL database related resources after you're done with them, but at worst at the end of handling a single http request
4) do so inside a finally block so you are assured they are indeed closed
5) introduce some proper exception handling
6) we don't care that you have only 3 days left, start earlier next time
7) use the correct JSP version for your web application version (you do have a web.xml I hope? If not you just lost more points on your assignment)

That should be enough to keep you occupied for a few days.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.