Ajax与Javascript和Struts 1.2的集成



如何在jsp页面中为不同的客户设置不同的票据编号,以便当我为两个客户输入相同的票据编号并单击保存时,它将清除该文本字段并允许我输入另一个,或者它将显示一条消息,表明票据编号已交给客户?

这不是你应该做的。

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`

最新更新