Buffalo Ajax Framework uses __ajax

Source: Internet
Author: User

buffalo-2.0 (Chinese developed AJAX framework), download Buffalo-2.0-bin on it, personally think also download buffalo-2.0-src
Download Address: http://sourceforge.net/project/showfiles.php?group_id=178867

1. Buffalo-2.0.jar
In Buffalo-2.0-bin, add it to the Lib in the Web application

2. Buffalo.js and Prototype.js
I put these two files in the scripts/directory of the Web application, buffalo.js in Buffalo-2.0-bin, prototype.js in Buffalo-demo.war.

4. Web.xml content
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "2.4"
Xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation = "Http://java.sun.com/xml/ns/j2ee
Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">


<servlet>
<servlet-name>bfapp</servlet-name>
<servlet-class>net.buffalo.web.servlet.ApplicationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>bfapp</servlet-name>
<url-pattern>/bfapp/*</url-pattern>
</servlet-mapping>

</web-app>

5. index.jsp file
<%@ page language= "java" pageencoding= "UTF-8"%>


<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<title> First Buffalo sample program </title>
<script language= "JavaScript" src= "Scripts/prototype.js" ></script>
<script language= "JavaScript" src= "Scripts/buffalo.js" ></script>
<script type= "Text/javascript" >
var endpoint= "<%=request.getcontextpath ()%>/bfapp";

var buffalo = new Buffalo (endPoint);
function Hello (me) {
Buffalo.remotecall ("Demoservice.gethello", [Me.Value], function (Reply) {
Alert (Reply.getresult ());
})
}
</script>

<body>
Enter your name: <input type= "text" name= "MyName" >
<input type= "button" value= "BUFFAO Remote Call" onclick= "Hello (' myname ')"; ><br>
</body>
Description: Remotecall is a remote invocation method, Demoservice is the key to the Buffalo-service.properties file, Gethello is called Java class method name, Me.Value is passed to the Gethello method parameters, Reply.getresult () Is the value returned by Gethello.

6. Demoservice.java file
Package Demo.buffalo;

/**
*
* @ filename Demo.buffalo.DemoService.java
* @ Author CHENLB
* @ creation Time 2007-7-14 12:42:17
*/
public class Demoservice {

public string Gethello (string name) {
Return "Hello," +name + "This is the first Buffalo sample program";
}
}
7. buffalo-service.properties files into the web-inf/classes/directory
Demoservice=demo.buffalo.demoservice Description: The framework uses this file to find the classes that are invoked remotely.

8. Now it's ready to run.

Sample Downloads
Note: Eclipse project, file encoding is UTF-8

Official address:
Buffalo Chinese Forum: Http://groups.google.com/group/amowa
Http://buffalo.sourceforge.net/tutorial.html

http://confluence.redsaga.com/pages/viewpage.action?pageId=1643 JavaScript api:http://confluence.redsaga.com/ Display/buffalo/javascript+api
http://www.amowa.net/buffalo/zh/index.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.