2014-10-29 70 views
-1

如何在jsp页面中为不同的客户设置不同的账单号,这样当我为客户输入相同的账单号并点击保存时,它将清除该文本字段并允许我进入另一个账户其中一个还是会显示消息,说明账单没有交给客户?Ajax与Javascript和Struts 1.2的集成

回答

0

那么这不是你应该这样做的方式。

Reason : It looks like Bill number is unique id or a primary id for one of your table. 
Solution: Do not allow the user to input the bill no, generate it at the server side by your code or just increment the value of the bill no at database level(e.g auto_increment). 

if still you do not want to do it at the database level you can keep a `static field named billNo` anywhere in your code and just increment its value everytime a request is made. 
Problems: This method will fail when your application restarts. you will loose this count. 
Solution: Get the last saved bill no from database and set it to the field `billNo`