• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in inserting session data in jsp/servlet application

 
J Das
Ranch Hand
Posts: 83
Firefox Browser Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 InfoServlet.java , 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.....

index.jsp-->>


=======================================

BusServlet.java-->>




=======================================

view.jsp-->>




=======================================

form.jsp-->>



=============================================

InfoServlet.java -->>

 
jeya velan
Greenhorn
Posts: 9
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you getting any exception.
# Statement s = connection.createStatement();
#
# s.executeQuery (sql);
#
# rs = s.getResultSet();
#
#
#
# String bid = rs.getString("bus_id");

I think rs.next() is required before running any getters on the result set.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic