|
首先引用jabsorb-1.2.2.jar,slf4j-api-1.4.2.jar,slf4j-jdk14-1.4.2.jar,jsonrpc.js
類文件:
package com.test;
import Java.util.HashMap;
import Java.util.Iterator;
import Java.util.LinkedList;
import Java.util.List;
import Java.util.Map;
import Java.util.Set;
public class TestJabsorb {
public String getMessage(String s) {
return "你好: " + s;
}
public String getMessage() {
return "無(wú)參數(shù)";
}
public String getMessage(List al) {
String res="list參數(shù):";
for(Iterator it = al.iterator();it.hasNext();){
Object next = it.next();
res+=next+",";
}
return res;
}
public String getMessage(String[] array) {
String res="數(shù)組參數(shù):";
for(int i=0;i<array.length;i++){
res+=array[i]+",";
}
return res;
}
public String getMessage(Map map) {
String res="map參數(shù):";
Set entrySet = map.entrySet();
for(Iterator it = entrySet.iterator();it.hasNext();){
Object next = it.next();
res+=next+",";
}
return res;
}
public String getMessage(Test2 t2) {
String res="Test2(bean)參數(shù):";
res+=t2.p1+",";
res+=t2.p2+",";
return res;
}
public String getMessage(Test3 t2) {
String res="Test3(bean)參數(shù):";
res+=t2.p1+",";
res+=t2.p2+",";
return res;
}
public Test2 getMessage2() {
Test2 res=new Test2();
res.p1="11";
res.p2="22";
return res;
}
public Test3 getMessage3() {
Test3 res=new Test3();
res.p1="11";
res.p2="22";
return res;
}
public List getList()
{
List list = new LinkedList();
list.add("中國(guó)");
list.add(1234);
return list;
}
public Map getMap()
{
Map map = new HashMap();
map.put("bird", "鳥(niǎo)");
map.put("human", "人類");
return map;
}
}
package com.test;
public class Test2{
public String p1;
public String p2;
public String getP1() {
return p1;
}
public void setP1(String p1) {
this.p1 = p1;
}
public String getP2() {
return p2;
}
public void setP2(String p2) {
this.p2 = p2;
}
}
JavaScript技術(shù):jabsorb筆記_幾個(gè)小例子第1/2頁(yè),轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。