向服务器发送数据有get和post两种.
首先,要将body中的html代码替换为
<pre class="brush:php;toolbar:false;"> <button dojoType="Button" widgetId="helloButton">Hello World!</button><BR> <br><BR> 请输入名称: <input type="text" id="name">
<pre class="brush:php;toolbar:false;"> function helloPressed()<BR> {<BR> dojo.io.bind({<BR> url: 'response.txt',<BR> handler: helloCallback<BR> });<BR> }<BR>替换为:<BR><pre class="brush:php;toolbar:false;"> function helloPressed()<BR> {<BR> dojo.io.bind({<BR> url: 'HelloWorldResponseGET.jsp',<BR> handler: helloCallback,<BR> content: {name: dojo.byId('name').value }<BR> });<BR> }<%<BR> /*<BR> ' HelloWorldResponseGET.jsp<BR> ' --------<BR> '<BR> ' 打印name的值.<BR> '<BR> */<br><br> response.setContentType("text/plain");<BR>%>Hello <%= request.getParameter("name") %> ,欢迎来到dojo世界!<pre class="brush:php;toolbar:false;"> <button dojoType="Button" widgetId="helloButton">Hello World!</button><BR> <br><BR> <form id="myForm" method="POST"><BR> 请输入名称: <input type="text" name="name"><BR> </form>
<pre class="brush:php;toolbar:false;"> function helloPressed()<BR> {<BR> dojo.io.bind({<BR> url: 'HelloWorldResponsePOST.jsp',<BR> handler: helloCallback,<BR> formNode: dojo.byId('myForm')<BR> });<br><br> }http://dojo.jot.com/WikiHome/Tutorials/HelloWorld
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号