File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes problem in inserting session data in jsp/servlet application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem in inserting session data in jsp/servlet application" Watch "problem in inserting session data in jsp/servlet application" New topic

problem in inserting session data in jsp/servlet application

J Das
Ranch Hand

Joined: Jul 27, 2011
Posts: 83

I am working on an online bus ticket booking project in jsp/servlet... using tomcat6 and mysql in netbeans... now i know i have done some really foolish and ancient coding .. but please help me in getting this done ... i am actually stuck in this session thing... look below in the view.jsp code, there i have provided link ( as input for the selected bus in which a user would prefer to travel) ... now the next sevlet code which is , this code takes the responsibility of inserting the booking of a ticket for the bus... The tables that i have made are...

bus ( bus_id,bus_name,departure,arrival,departure_time,arrival_time,available_tickets,price)
customer ( cus_id,cus_name,address,email,ccno)
booking ( book_no,cus_id,book_date)
booking_list (book_no, bus_id, tickets)

except the booking_list table , data in other tables are geting inserted... because the booking_list table needs bus_id ( which is only available from the bus table , for which we will have to know the bus selected by the user i.e., previous data or session data is necessary ).. I am somewhere wrong in implementing this part.... so please help me in correcting the code here... As i said , i know i have done serious crimes by implementing foolish coding standards... apart from that please help me corecting this anyway... thanks in advance... the codes according to flow of the web app are given below.....







============================================= -->>

jeya velan

Joined: Feb 07, 2011
Posts: 9

Are you getting any exception.
# Statement s = connection.createStatement();
# s.executeQuery (sql);
# rs = s.getResultSet();
# String bid = rs.getString("bus_id");

I think is required before running any getters on the result set.
I agree. Here's the link:
subject: problem in inserting session data in jsp/servlet application
It's not a secret anymore!