here is the code for my cart. /*this is the first jsp file here i am using a bean to connect to my database book which i have made using msaccess.this bean ha connect method to connect to database, a method to execute the query and a close method to close the connection. here in jsp we are retireving data from database depending on which category of book user clicks on.here after adding items to cart when we click on viewcart.jsp forward tag is used to take user to second jsp page which should show the cart items. */
i am using tomcat server 3.1 for my project. the problem i am getting is with second jspfile ,the error i get is servletexception plz help me solve this bug thanx rupa
[This message has been edited by maha anna (edited December 10, 2000).]
rupa agarwal
Greenhorn
Joined: Nov 21, 2000
Posts: 24
posted
0
plz help me this is urgent
Originally posted by rupa agarwal: here is the code for my cart. /*this is the first jsp file here i am using a bean to connect to my database book which i have made using msaccess.this bean ha connect method to connect to database, a method to execute the query and a close method to close the connection. here in jsp we are retireving data from database depending on which category of book user clicks on.here after adding items to cart when we click on viewcart.jsp forward tag is used to take user to second jsp page which should show the cart items. */
<%@ page import ="java.util.*, java.io.*,java.sql.*" %> <jsp:useBean id="ConnectM" class="rupa.project.ConnectMeBean" scope="session"/> <html> <head> <title>The books database</title> <script language=JavaScript> var i=0; var itemname; function submitcategory(a) { document.myform.myfield.value = a ; document.myform.submit(); } function hi(){ document.myform.submit(); } function hi1(b){ document.myform.myfield1.value = b; document.myform.submit(); } </script> </head> <body> <h1>books datadase</h1><br> <% String category = ""; if(request.getParameter("myfield")!=null) category = request.getParameter("myfield");
%> <form name=myform> <input type=hidden name="myfield" value="<%=category%>"> <A href="javascript:submitcategory('webdesigning')">Category1</a><br> <A href="javascript:submitcategory('Java')">Category2</a><br> <A href="javascript:submitcategory('Cooking')">Category3</a><br> <A href="javascript:submitcategory('Travel')">Category4</a><br> <A href="javascript:submitcategory('History')">Category5</a><br> <% ResultSet r = null; if(request.getParameter("myfield")!=null) { ConnectM.connectdb(); String CategoryName = request.getParameter("myfield"); r = ConnectM.execquery("select * from book where bkcat =" + "'" + CategoryName + "'");
</body> </html> here is the code for teh bean /*this is the bean for conecting to the database*/ package rupa.project; import java.util.*; import java.io.*; import java.sql.*; import java.net.*; public class ConnectMeBean implements java.io.Serializable{ Connection con=null; Statement s = null; ResultSet rs = null;
public boolean connectdb(){ try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} i am using tomcat server 3.1 for my project. the problem i am getting is with second jspfile ,the error i get is servletexception plz help me solve this bug thanx rupa
Why in the name of all that is reasonable are you ignoring the data contained in the various exceptions that you catch and discard? You should be at least printing the exception to System.out. With JSP you can define an errorPage in the page directive and have it dump the ServletException in some usable form. Bill
Hi rupa, Why are u not catching exception at line while(rss.next())
Because you are trying to send 'null' in case if your 'execquery' method result in exception. Are you sure 'itemnum' in table is character? May because of this you are getting the exception, regards, R V Holla.
rupa agarwal
Greenhorn
Joined: Nov 21, 2000
Posts: 24
posted
0
hi there i guess that is a problem with my itemnum coz it if of type integer it might be giving an error what shld i do to solve this bug plz suggest
rupa agarwal
Greenhorn
Joined: Nov 21, 2000
Posts: 24
posted
0
hi there plz could anybody help me regarding my code that i have posted i have not received a solutionto my problem thanx rupa
rupa agarwal
Greenhorn
Joined: Nov 21, 2000
Posts: 24
posted
0
ghi therre i have yet not received a solution to my problem could someone guide me plz.
rupa agarwal
Greenhorn
Joined: Nov 21, 2000
Posts: 24
posted
0
hi there can anyone help me in this code of mine i get servlet excepiton code .