rupa agarwal

Greenhorn
+ Follow
since Nov 21, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by rupa agarwal

hi there everyone i have postd the details of my project at this site under the topic got servlet exception errorin my code(urgent).all teh details along with the coe is there if ur interested plz email me at agrup@hotmail.com
thanx
rupa
23 years ago
hi there can anyone help me in this code of mine i get servlet excepiton code .
23 years ago
Hi theer i am currently doing aproject in jsp ,it is a shopping cart project and i think it is good enough to clear ur concepts.
23 years ago
hi there,
i am rupa agarwal and i wouls definetely like to join u in this project of urs i am currently doing a shopping cart project,and would surely liek to join u,
do reply if ur interested
my email id is agrup@hotmail.com
23 years ago
hi everyone thanx for ur esponse if u rintereeted in joining me my email id is agrup[@hotmail.com u can email me there.and my project code details i haev posted on this site u can go thru it if u want.
and if anyone has done some small applicatin in jsp and bweanns can u plz fwd it to me it canbe useful to me
thanx
23 years ago
when i select this option it takes me thee but the applet is niot loaded it shows blank screen.what can i do to sought out this.
plz help me
23 years ago
ghi therre i have yet not received a solution to my problem could someone guide me plz.
23 years ago
hi there i want a project partner can anybody plz join me i am still looking for a partner
awaiting response
23 years ago
hi there plz could anybody help me regarding my code that i have posted i have not received a solutionto my problem
thanx
rupa
23 years ago
hi there thanx for guiding me can u plz tell me that the book which i hacve gone thru the boooks name which i have mentioned is that nice enough coz i am doing a shopping cart project and i need some good books on jsp helping me do the project plz help me
23 years ago
hi there plz could some one guide me which books shld i refer to prepare for teh sun certification exam.
plz reply coz i had alreafy posted this rquest but it was sad to see that ia havent received any guidance ,it is urgent plz guide me
rupa
hi there i just have started working with jsp,and i cannot understand which book should i buy for jsp could someone plz guide me is the book using jsp and servlets by mark wutka nice coz i just went thru it.
plz guide me
23 years ago
hi there could anyone suggest me what books cna i buy to prepare for the new java sun certification exam for programmer.
what are the new changes in the java sun certification.
how much time does it reqire to prepare for it.
plz reply asap.
thanx
rupa
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
23 years ago

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 + "'");

while(r.next()){
String itemnum = r.getString(2);
String bkcat= r.getString(3);
String bktitle = r.getString(4);
String bkprice = r.getString(5);
String bkqty = r.getString(6);
String bkauthor = r.getString(7);
String bkdetail = r.getString(8);

%>
<table>
<tr><td>
<b><%=itemnum%></b></td>
<td><%=bkcat%></td>
<td><%=bktitle%></td>
<td><%=bkprice%></td>
<td><%=bkqty%></td>
<td><%=bkauthor%></td>
<td><%=bkdetail%><br></td>
<td><input type=checkbox name="select" value=<%=itemnum%>>
</tr>
</table>
<%
}
}
%>
<% HttpSession s = request.getSession(true);
Integer itemcount = (Integer) s.getValue("itemcount");
if(itemcount == null)
{
itemcount = new Integer(0);
}
if(request.getParameterValues("select")!=null)
{
String [] itemselected = request.getParameterValues("select");
String itemname = "";
int a = itemcount.intValue();
for(int i=a ; i< itemselected.length+a ;i++)
{
out.println("You selected."+itemselected[i-a] );
itemname = itemselected[i-a];
itemcount = new Integer(itemcount.intValue() + 1);
s.putValue("Item" +i,itemname);
s.putValue("itemcount",itemcount);
}
}
%>
<% out.println("u have" +itemcount.intValue() +"items");
for(int i=0;i <itemcount.intValue();i++)
{
String item = (String) s.getValue("Item" +i);
%>
VALUE<%=item%><br>
<% }
ConnectM.closedb();
%>
<input type=Submit value="add to cart" onClick="javascript:hi()">
<input type=hidden name="myfield1" value="">
<input type=button value="view cart" name="viewcart" onClick="javascript:hi1('viewcart')">
<% if(request.getParameter("myfield1")!=null)
{ if(request.getParameter("myfield1").equals("viewcart"))
{
%>
say hi
<jsp:forward page="/rupa/project/cart1.jsp" />
<%
}
else{
%>
say bye
<%}
}
%>
</form>
</body>
</html>
jsp file 2 is here/*this is the cart jsp file which should the user the cart items
here again the same bean is used and depending on the users selected items
it retrieves the info from the database. for that itemnumber.
where itemnum is filed in the database.here in this file i get a servlet exception
rest the first jsp file is working fine
*/
<%@ page import ="java.util.*, java.io.*,java.sql.*" %>
<jsp:useBean id="ConnectM1" class="rupa.project.ConnectMeBean" scope="session"/>
<html>
<head>
<title>The cart</title>
</head>
<body>
<h1>this is ur carty</h1><br>
<%
out.println("iisorry empty session");
ResultSet rss = null;
HttpSession s = request.getSession(true);
if(s == null)
{ out.println("sorry empty session");
}
ConnectM1.connectdb();
Integer itemcount1 = (Integer) s.getValue("itemcount");
if(itemcount1 == null)
{
out.println("error getting the value of itemcount");
itemcount1=new Integer(0);
out.println(itemcount1);
}
for(int i=0;i <itemcount1.intValue();i++)
{
String item1 = (String) s.getValue("Item" +i);
int item2 = Integer.parseInt(item1);
%>
VALUE<%=item2%>
<%
rss = ConnectM1.execquery("select * from book where itemnum =" + "'" + item2 + "'");

while(rss.next()){

String bkcat1= rss.getString(3);
String bktitle1 = rss.getString(4);
String bkprice1 = rss.getString(5);

%>
<form>
<table>
<tr><td>
<%=bkcat1%></td>
<td><%=bktitle1%></td>
<td><%=bkprice1%></td>
</tr>
</table>
</form>
<%}
}
ConnectM1.closedb();%>
</body>
</html>%>

</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");

con = DriverManager.getConnection("jdbc dbc:mage", "", "");
return true;
}catch(Exception e){
return false;
}
}
public ResultSet execquery(String Sql){
try{
//Sql = "select * from book";
s = con.createStatement();
rs = s.executeQuery(Sql);
return rs;
}catch(Exception e){
return null;
}
}
public void closedb(){
if(rs !=null) {
try{
rs.close();}
catch(SQLException ignore){}
}
if(s !=null) {
try{
s.close();}
catch(SQLException ignore){}
}
if(con !=null) {
try{
con.close();}
catch(SQLException ignore){}
}



}

}
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


23 years ago