使用jsp和servlet预订客房 [英] Room booking using jsp and servlet

查看:64
本文介绍了使用jsp和servlet预订客房的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用textfile(未使用的数据库)在jsp中创建了登录用户和密码,并且我有一个房间预订表单,一旦一个用户预订了房间,下一个登录Web应用程序的用户就不应该预订。请告诉我如何在不使用数据库的情况下继续操作。请帮助我作为编程新手



我尝试过:



i have created login user and password in jsp using textfile (not used database) and i have a form for room booking ,once the room booked by one user it should not be booked by the next user who login the web app .please tell me how to proceed without using database.please help me as im new to programming

What I have tried:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

body {background-color: powderblue;}
 



 <%
 response.setHeader("Cache-Control","no-cache,no-store,must-revalidate" );
 
 if(session.getAttribute("username")==null)
{
	response.sendRedirect("LoginPage.jsp");
}
 %>
 







<br>
  <br>

  
  

  



  <table cellpadding="2" width="20%" align="center" cellspacing="2"><tbody><tr>  <td colspan="2">  <center><font size="4">BOOKING  FORM</font></center>

  </td>  </tr><tr>  <td>NAME</td>  <td></td>  </tr>  <tr><td>EMPID</td>  <td></td>  </tr><tr>  <td>EMAILID</td>  <td></td>  </tr><tr>  <td>PROJECT</td>  <td>

  CITI

  BOA

  SBI

  BMW

  AUDI

  </td>  </tr><tr>  <td>FLOOR</td>  <td>

 

  one

  two

  

  </td>  </tr>  <tr>  <td>ROOMS</td>  <td>

  16 seater

   8 seater

  

  </td>  </tr><tr><td>MobileNo</td>  <td></td>  </tr>  <tr>  <td></td>  <td colspan="2"></td>  </tr>  </tbody></table>

推荐答案

引用:

请告诉我如何在不使用数据库的情况下继续进行。

please tell me how to proceed without using database.



不好主意,每个人都使用数据库的原因是因为它们很有效。

如果你有50个房间,1年的预订可以是18000个记录,你必须阅读每一个请求的每一条记录,更糟糕的是每次你写一个新的记录,你将不得不锁定文件,问题,它会阻止其他人访问该数据。相信我,它效率不高。

所以建议尽快学习数据库。




Bad idea, the reason why everyone use databases is because they are efficient.
If you have 50 rooms, 1 year of booking can be 18000 records, and you will have to read every single record for every single request, even worse every time you write a new record, you will have to lock the file, problem, it will prevent others from accessing that data. Believe me, it is not efficient.
So the advice is to learn databases as soon as possible.

引用:

请帮助我作为新手编程



建议:暂时忘记真实项目并花些时间正确学习。

查找教程和学习。


Advice: Forget real projects for now and take time to learn properly.
Find tutorials and study.


这篇关于使用jsp和servlet预订客房的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆