Hello world, buffalohelloworld

Source: Internet
Author: User

Hello world, buffalohelloworld

A Chinese ajax framework defines the Transmission Basis for remote Web calls,

In addition, the remote call object is serialized locally to become an object that can be touched by JavaScript programming.


Configure the dependency package:

<dependency><groupId>net.buffalo</groupId><artifactId>buffalo</artifactId><version>2.0</version></dependency>

Note: Since I installed it manually to the maven local repository and customized a coordinate, you can also directly put it under the WEB-INF/lib


Configure web. xml

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><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>



HelloService:

package com.demo;public class HelloService {public String sayHi(String name){System.out.println("hello "+name);return "hello world";}}


Configuration file;

Buffalo-service.properties:

## Buffalo Service ConfighelloService=com.demo.HelloService


Introduce js:

<script language="JavaScript" src="js/prototype.js"></script><script language="JavaScript" src="js/buffalo.js"></script>


Index. jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 

Result:



Printf ("Hello, world") and printf ("Hello, world! \ N ") What is the difference?

This is because printf is Row-buffered (because it is connected to the terminal,/dev/ttys0, otherwise it is full-buffered ).
During fork, the io buffer of the parent process has not been cleared (or it may be a child process, but the order is not clear at this time .), Therefore, the output of the content of the Parent and Child processes is two hello world rows in one row.
After a line feed is added, printf caches the rows. Therefore, after fork, only one hello world will be removed.

You can add a sleep of 2 seconds before fork to see it clearly.

Refer to the section on standard I/O and Process Control for advanced unix programming.

Hello, world

Echo "hello, world! ";
MessageBox. Show ("hello, world! ");
Console. Write ("hello, world! ");
AfxMessageBox ("hello, world! ");
Cout <"hello, world ";
Printf ("hello, world ");
System. out. println ("hello, world ");

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.