⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial.html

📁 比dwr更好的ajax框架,中国人写的.
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">










<html>
  <head>
    <title>Buffalo AJAX - 1 Minute Tutorial</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      </head>
  <body class="composite">
    <div id="banner">
                  <a href="index.html" id="bannerLeft">
    
                                            <img src="images/buffalo-title.gif" alt="" />
    
            </a>
                        <a href="http://sourceforge.net" id="bannerRight">
    
                                    <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=178867&type=1" alt="" />
    
            </a>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
            <div class="xleft">
        Last Published: 10/08/2006
                      </div>
            <div class="xright">      <a href="http://www.amowa.net/buffalo/zh">Chinese Docs</a>
          
  

  
    
  
  
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
                   <h5>Quick Start</h5>
        <ul>
              
    <li class="none">
              <strong>1 Minute Tutorial</strong>
        </li>
              
    <li class="none">
              <a href="http://demo.amowa.net/buffalo-demo/">Demo</a>
        </li>
              
    <li class="none">
              <a href="download.html">Download</a>
        </li>
              
    <li class="none">
              <a href="features.html">Features</a>
        </li>
              
    <li class="none">
              <a href="faq.html">FAQ</a>
        </li>
          </ul>
          <h5>Mastering Buffalo</h5>
        <ul>
              
    <li class="none">
              <a href="best_practice.html">Best Practise</a>
        </li>
              
    <li class="none">
              <a href="howto.html">How to...</a>
        </li>
          </ul>
          <h5>Reference</h5>
        <ul>
              
    <li class="none">
              <a href="jsapi.html">JavaScript API</a>
        </li>
          </ul>
                                       <a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>1 Minute Tutorial </h2><div class="section"><h3>Prepare</h3><p>Please download the latest version of buffalo distribution. Create a directory structure as follows:</p><div class="source"><pre>buffalo-example
  WEB-INF/classes
  WEB-INF/lib
  script
</pre></div><p>Copy burlap-2.1.2.jar, buffalo-<i>version</i>.jar to WEB-INF/lib, copy prototype.js, buffalo.js to script.</p></div><div class="section"><h3>Edit web.xml</h3><p>Create a web.xml in WEB-INF with content as follow:</p><div class="source"><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE web-app PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot; &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot;&gt;
&lt;web-app&gt;
&lt;display-name&gt;Buffalo Example Application&lt;/display-name&gt;
&lt;servlet&gt;
    &lt;servlet-name&gt;bfapp&lt;/servlet-name&gt;
    &lt;servlet-class&gt;net.buffalo.web.servlet.ApplicationServlet&lt;/servlet-class&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;bfapp&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/bfapp/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</pre></div></div><div class="section"><h3>Edit buffalo-service.properties</h3><p>Create a text file buffalo-service.properties to WEB-INF/classes with content as follow:</p><div class="source"><pre># Example Service
helloService=example.HelloService
</pre></div></div><div class="section"><h3>Edit JSP file</h3><p>Create example.jsp in the web root:</p><div class="source"><pre>&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html&quot;&gt;
&lt;title&gt;Example::Hello&lt;/title&gt;
&lt;script language=&quot;javascript&quot; src=&quot;script/prototype.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot; src=&quot;script/buffalo.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
var END_POINT=&quot;&lt;%=request.getContextPath()%&gt;/bfapp&quot;;
var buffalo = new Buffalo(END_POINT);
function hello() {
    var p1 = $(&quot;myname&quot;).value;
    buffalo.remoteCall(&quot;helloService.hello&quot;,[p1], function(reply) {
        alert(reply.getResult());
    });
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;p&gt;Buffalo Hello World&lt;/p&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
    &lt;form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;&gt;
      Your name: 
      &lt;input name=&quot;myname&quot; type=&quot;text&quot; id=&quot;myname&quot;&gt;
      &lt;input type=&quot;button&quot; name=&quot;Submit&quot; value=&quot;Hello&quot; onclick=&quot;hello()&quot;&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></div></div><div class="section"><h3>Adding a Service</h3><div class="source"><pre>package example;
public class HelloService {
public String hello(String name) {
  try {
    // to see the loading status
    Thread.sleep(2000);
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  return &quot;Hello, &quot; + name;
  }
}
</pre></div><p>Compile it and copy the binary class file to WEB-INF/classes.</p></div><div class="section"><h3>Final step: run the application</h3><p>Copy the whole buffalo-exmaple directory to TOMCAT_HOME/webapps, start tomcat, open browser and visit http://localhost:8080/buffalo-example/example.jsp, input your name and click &quot;Hello&quot; button, see the result.</p></div><div class="section"><h3>Further more</h3><p>Please read spring integration and best practice for more information</p></div></div>
      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2004-2006
    
          
  

  
    
  
  
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -