A new method to develop with ajax application

本文介绍了一种新的Ajax应用开发方法——配置式Ajax开发。该方法通过在服务器上创建配置文件,并利用反射机制从加载的文件中获取实例及执行结果。开发过程中仅需一个Servlet作为数据源,通过调用JavaScript函数即可实现客户端与远程服务器的数据交互。
 

A new method to develop  with ajax application

 

 

As we knew ,  if we want to invoke the services or data from remote server, it’s called ajax,  the first step to set up an ajax demo is to create a remote page or service in your web server,  then by the script located into browser, we could get what we want in our client.

 

The process is similar with this .

 

 

 

After understanding the basic concept about this process , I conclude another method to develop with ajax application. For that, I call it “configurating  ajax development”.

 

For the first, I create a configuration file on the server, reloading that file every time when web application server starts up, in the configuration file, a kind of XML format, some segments and elements are defined there, then we use  a single servlet source , by that, we invoke the javascript functions to get remote data from servlet page, especially, I will make more introduction about the process and how they work.

 

As follows, a diagram is presented here .

 

 

 

 

 

By using the reflecting foundation, we can get instance from loaded file, and get executing result. It seems to be easy.

BadRequestKeyError werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'data' Traceback (most recent call last) File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 1536, in __call__ return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Open an interactive python shell in this frame File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 1514, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 1511, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 919, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\.venv\Lib\site-packages\flask\app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\app.py", line 20, in submit data = request.form['data'] ^^^^^^^^^^^^^^^^^^^^ File "D:\develop\my_program\myp1\.venv\Lib\site-packages\werkzeug\datastructures\structures.py", line 238, in __getitem__ raise exceptions.BadRequestKeyError(key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'data' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.为什么提交完表单报错了
09-03
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值