0 Replies - 373 Views - Last Post: 18 April 2009 - 04:25 PM Rate Topic: -----

#1 Artist001  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-March 09

Passing from page to page

Posted 18 April 2009 - 04:25 PM

Hi folks. I'm trying to put together a fairly basic booking system in which a user will be able to view a number of bands. Select the band they want to see, from there select which section of the arena(that particular band is playing at) they want to book tickets for. Choose how many tickets they want, be able to view the total price and have that information carry across to another jsp that will include a form for them to input their details. Then be able to add the bookings to the database. Having a few problems though.
First, once the showlist appears displaying the bandnames, the arenas and dates, on clicking on a bandname, the next jsp should display "the band (whichever band has been chosen) will be playing at (whatever the arena is) on ( whatever the date is)".
I'm getting the bandname to appear, but then it's says will be playing at null on null
Don't know where i'm going wrong. Can someone help me with this?
Many thanks in advance
Hee's the code for the showlist.jsp
<%

// Get the showlist
	ShowList showlist = (ShowList) application.getAttribute("ShowList");

	if (showlist == null)
	{

		synchronized (application)
		{
			// get data from JDBC 
			showlist = ShowListDAO.getAll();
			
			application.setAttribute("ShowList", showlist);
		}
	}

	  List shows = showlist.getShows();

	Iterator itr = shows.iterator();
	 while (itr.hasNext())
	{
		Show show = (Show) itr.next();
		 
	   
// Create the URL for booking the show
		String addItemURL =
			"BookShow.jsp?"+
			"Show_id"+URLEncoder.encode(show.getShow_id())+
			"Band_name"+URLEncoder.encode(show.getBand_name())+
			"Arena"+URLEncoder.encode(show.getArena())+
			"Date"+URLEncoder.encode(show.getDate());
%>
		   <tr>
		   <td><a href="BookShow.jsp?BANDNAME=<%=show.getBand_name()%>"><%=show.getBand_name()%>
		   <td><%=show.getArena()%>
		   <td><%=show.getDate()%>
<%
	}
%>


And here's the code for the following jsp
<%
String Show_id = request.getParameter("Show_id");
String Band_name = request.getParameter("BANDNAME");
String Arena = request.getParameter("Arena");
String Date = request.getParameter("Date");
session.setAttribute("BANDNAME", Band_name);
%>

<h3>The band  <%=Band_name%> will be playing at <%=Arena%> on <%=Date%></h3>


Is This A Good Question/Topic? 0
  • +

Page 1 of 1