日期:2014-05-17 浏览次数:21020 次
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'dwr.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!-- 下面的MyService.js中的MyService为dwr.xml中的javascript的值 -->
<script type="text/javascript" src="/dwr/ajax/interface/MyService.js"></script>
<script type="text/javascript" src="/dwr/ajax/engine.js"></script>
<script type="text/javascript">
function doCal(){
var first = document.all.first.value;
var second = document.all.second.value;
var oper = document.all.oper.value;
if(oper=="multi"){
MyService.multi(first,second,callback);
}
else if(oper=="div"){
MyService.div(first,second,callback);
}
else if(oper=="plus"){
MyService.plus(first,second,callback);
}
else if(oper=="sub"){
MyService.sub(first,second,callback);
}
}
function callback(value){
var v = document.getElementById("value");