2014-10-29 100 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`