How to prevent duplicate entries while refreshing?

后端 未结 4 1800
情深已故
情深已故 2021-01-02 23:17

I have an index.jsp page where I have a form where the user enters some data that gets stored in the database using a Controller servlet.

I want to disp

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-02 23:32

    I would add an invisible ID to the page. If the data is new to the database (ID = unknown), insert and create an ID and update the page with the ID. That way you know if it is a ID != unknown, and you don't have to do an insert. And if the data hasn't changed, you don't even have to do an update...

提交回复
热议问题