在Web应用程序中显示消息 [英] displaying the message in web application

查看:67
本文介绍了在Web应用程序中显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

Gud mng.我的疑问是我正在通过将数据从Web应用程序插入到SenderId列中来更新名为userinfo的表中的数据.每当我通过Web应用程序插入SenderId时(如果输入的SenderId已存在于数据库中),它就会以显示一条消息,因为SenderId已经存在,并且不会采用重复的值.请给我任何答案.我正在使用Servlet和JSP.正在等待答复.



在此先感谢.

Hi All,

Gud mng.My doubt is i am updating the data in the table called userinfo by inserting the data into the SenderId column from the web application.Whenever i am inserting the SenderId through the webapplication if the entered SenderId is already there in Database then it has to show a message as SenderId already exists and it is not going to take the duplicate values.Can you please give me any answer. I am using Servlets and JSP''s.Waiting for the reply.



Thanks In Advance.

推荐答案

您绝对应该在数据库中使用自动字段,并让它们自动更新...

您的设计可以允许两个人同时访问数据库,然后尝试插入相同的数据.而且除了前面所述的方法之外,您没有其他方法可以避免这种情况.

在数据库中使用主键/辅助键和自动数字字段;这样您就可以避免这种情况.

如果您在执行此操作时遇到问题,应告诉我们您所使用的数据库类型,因此我们将随时为您提供帮助...

祝你好运.

*改进1:
想法是您不应手动引入密钥,以避免重复的值.
您应该检查引入的数据是否已经存在,如果没有,则应正常插入数据,但不要使用senderId.
MySQL数据库(如果使用AUTO-INCREMENT)将为您做到这一点.

看看此链接 [此链接 [
You should definitely use automatic fields in the database and get them to be updated automatically...

Your design could allow that two people would access the database at the same time and then try to insert the same data. And you don''t have any way to avoid that except the one described before...

Use primary/secondary keys, and autonumeric fields in your database; in that way you will avoid this kind of situations.

If you have problems doing that you should tell us the kind of database you are using and therefore we would be ready to help...

Good luck.

* IMPROVEMENT 1:
The idea is that you should not introduce the key manually in order to avoid duplicate values.
You should check if the data introduced is already there and if it is not, then you should INSERT it normally but without the senderId.
The MySQL database (if using AUTO-INCREMENT) will make that for you.

Take a look at this link[^] where you will find some extra details about using AUTO-INCREMENT and a sample of the scenario I''m talking about.

* IMPROVEMENT 2:
Take a look at this link[^].

Hope this helps.


这篇关于在Web应用程序中显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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