I would like to create a simple car Reservation web-based application that similar to this page. In that page, you can choose your location, destination and also Date of reservation. After you click next, the page will redirect you to another page where you choose time you desire, like this. If you click any of the time button, it will then display you an object ( a car ) that show booked or available seat information in the same page.
I have a database containing Unique ID, Location, Destination, Date, Time, and Seat available. In order to show time like the example above, I have to determine the location, destination, and date first ( since different destination and date will have different time). And to get information about how many seat available left, I have to determine the location, destination, date, and time.
In my application i have 3 .jsp page let's call it First.jsp (user input location, destination and date here) Second.jsp (information filled by user in first.jsp will pass here, and then passed again to third.jsp ) Third.jsp ( user input time here, the data will be passed to second.jsp. The whole data will be processed there. And the data will finally be passed back to Third.jsp displaying seat available information to user.
The problem is, I can pass data from first.jsp to third.jsp just fine. But after i retrieve data from third.jsp and pass it back to second.jsp. Data from the first.jsp is already gone. Which make it impossible for me to process the whole data there.
My overall code works like this :
First.jsp
<form action= second.jsp method= post>
<SELECT class: drop id: location name: locationlist>
<option value = locationvalue/>
</SELECT>
<SELECT class: drop id: destination name: destinationlist>
<option value = destinationvalue/>
</SELECT>
<SELECT class: drop id: date name: datelist>
<option value = datevalue/>
</SELECT>
<input type= submit name=submitbtn/>
</form>
Second.jsp
<c:if test=(param.time is empty)>
<c:redirect url: third.jsp>
<c:param name= locationvalue value${param.locationlist>
</c:redirect>
<c:if/>
<c:if test=(param is not empty>
<s:query
SELECT id, seat FROM schedule WHERE location = 'locationlist' destination = 'destinationlist' date = 'datelist' time = 'timelist' // does not work here
</s:query>
Third.jsp
<s:query dataSource="${ds}" var="resultset">
SELECT DISTINCT time FROM schedule WHERE location = '${param.locationvalue}'
</s:query>
<form action="second.jsp" method="post">
<center>
<c:forEach items="${resultset.rows}" var="row">
<input type="submit" value="${row.time}" name="time">
</c:forEach>
</center>
</form>