Web应用程序中没有多个服务 [英] No multiple Serches in an Web App

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

问题描述


我有一个具有耗时搜索功能的Webseite.
当前可以启动多个搜索请求.

例如:
用户在serch按钮上连续单击了10次...但是,第一次搜索未完成...其他9个搜索在管道中...
现在服务器已连续搜索10次.

我该如何预防?

thx,
benny

Hi,
I have an Webseite with a time-consuming search function.
currently it is porsible to start multiple search requests.

for example:
the user clicks a row 10 times on the serch button... but, the first search is not finisht... the other 9 searches are in the pipe...
now the server serch 10 times successively.

How can I prevent it?

thx,
benny

推荐答案

您可以在搜索过程开始时将搜索按钮的Enabled属性设置为false,然后在搜索完成时将其设置为true. ...假设您使用PostBack开始搜索.
You could set the search button''s Enabled property to false at the beginning of the search process, then set it back to true when the search is completed...assuming your using a PostBack to start the search.


这是我的设置,可以解决类似的情况:

1.单击应该启动按钮被禁用的动作的按钮后,第一件事! (javascript端)
2.通过AJAX调用在Web服务器上开始相同的单击(冗长的导出)过程.
3.1 Web服务器以指示该过程已开始的数据进行响应. ->按钮保持禁用状态,并设置了定期轮询(请参阅第4点.)
3.2 Web服务器以指示进程开始失败的数据来响应->. UI通知和按钮再次启用
4.1在3.1的情况下,请定期检查服务器上的过程是否已完成.
4.2完成显示结果后

在显示页面(是否回发)时,请确保仅在当前用户当前没有正在运行的搜索过程的情况下启用此按钮.

如果您有任何疑问,请随时给我评论.

最好的问候,

-MRB
This was my setup that managed a similar situation:

1. After click on button that is supposed to start the action that button is disabled first thing! (javascript side)
2. Same click starts (lengthy export) process on web server via AJAX call.
3.1 Webserver responds with data that indicates that the process was started. -> button stays disabled and a periodical polling is setup (see. point 4.)
3.2 Webserver responds with data that indicates failure in start of process -> UI notification and button is enabled again
4.1 In case of 3.1 periodically check if the process on the server has finished.
4.2 When finished show result

When displaying the page (postback or not) make sure that the button is only enabled if the current user does not have a search process currently running.

If you have any doubts left feel free to leave me a comment.

Best Regards,

-MRB


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

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