毕设用Buffalo实时保存部分的代码写了71行,第一次:)

毕设用Buffalo实时保存部分的代码写了71行,第一次:)

服务器端SimpleService.java
 1 package  net.buffalo.sei.simple;
 2 import  java.io.IOException;
 3 import  java.util. * ;
 4 import  java.io. * ;
 5
 6 public   class  SimpleService {
 7    public static void main(String[] args) throws IOException{
 8/**//*        2.Input from memory
 9        StringReader in2=new StringReader(sHandle.value);
10        int c;
11        while((c=in2.read())!=-1)
12            System.out.print((char)c);
13        
14*/

15        
16//        4.File output
17        try{
18            BufferedReader in4=new BufferedReader(
19                    new StringReader(sHandle.value));
20            PrintWriter out1=new PrintWriter(
21                    new BufferedWriter(new FileWriter("Interval.xml")));
22            int lineCount=1;
23            while((s=in4.readLine())!=null)
24                out1.println(lineCount++ + ":"+s);
25            out1.close();
26        }
catch(EOFException e){
27            System.err.println("End of stream");
28        }

29    }

30}
浏览器端部分相关代码:)
 1 < script  language ="JavaScript"  src ="script/prototype.js" ></ script >
 2 < script  language ="JavaScript"  src ="script/buffalo.js" ></ script >
 3 < script  language ="JavaScript"  src ="script/template.js" ></ script >
 4 < SCRIPT  language =javascript >
 5<!--
 6var endPoint="<%=request.getContextPath()%>/BUFFALO";
 7var buffalo = new Buffalo(endPoint);
 8function cmdSave() {
 9var sHandle = Buffalo.getElementById("description1");
10buffalo.remoteCall("simpleService.save",[buffalo:], function(reply) {
11  sHandle.value = reply.getResult();
12 }
)
13}

14//-->
15
</ SCRIPT >
16
17 < script  language =javascript >
18<!--
19setInterval("cmdSave()",60000);
20-->
21
</ script >
buffalo-service.properties
1 # simpleService, The simple Service
2 simpleService=net.buffalo.sei.simple.SimpleService
web.xml
 1 <? xml version="1.0" encoding="UTF-8" ?>
 2 <! DOCTYPE web-app PUBLIC "-Sun Microsystems, Inc.DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
 3 < web-app >
 4 < display-name > Buffalo Demo-divide Application </ display-name >
 5 < servlet >
 6    < servlet-name > service </ servlet-name >
 7    < servlet-class > net.buffalo.server.BuffaloServiceServlet </ servlet-class >
 8    < init-param >
 9     < param-name > debug </ param-name >
10     < param-value > true </ param-value >
11    </ init-param >
12 </ servlet >
13
14 < servlet-mapping >
15    < servlet-name > service </ servlet-name >
16    < url-pattern > /BUFFALO </ url-pattern >
17 </ servlet-mapping >
18 </ web-app >
又是71行:)

你可能感兴趣的:(毕设用Buffalo实时保存部分的代码写了71行,第一次:))