日期:2014-05-16  浏览次数:20650 次

什么方法能让客户端的button执行服务器端的任务,请教了,谢谢! - Web 开发 / Ajax
<input id="button_Export" type="button" title="Export starten" value="Export starten" onclick="startExport()">

function startExport() {

  }

在服务器端执行的是用java打开 cmd命令
Runtime.getRuntime().exec("cmd /c start ");

我的问题是通过什么办法能够实现通过点击按钮,触发服务器端cmd命令窗口打开。

var myAjax = new Ajax.Request(
'scripts/execute_export.jsp',
{
asynchronous: 'true',
parameters: params,
onSuccess: showExportFile,
onFailure: showError
}
)  
用上myAjax可以实现吗,如何写,谢谢!

------解决方案--------------------
可以实现的,在你提交到的页面execute_export.jsp中写
<%
Runtime.getRuntime().exec("cmd /c start ");
%>
就可以了。

------解决方案--------------------
不知道你的服务器的WEB应用有没有打开窗口这个许可