- 浏览: 8808 次
- 性别:
- 来自: 武汉
最新评论
Json-lib可以将Java对象转成json格式的字符串,也可以将Java对象转换成xml格式的文档,同样可以将json字符串转换成Java对象或是将xml字符串转换成Java对象。
原文地址:
JSON-lib框架,转换JSON、XML不再困难
http://www.cnblogs.com/hoojo/archive/2011/04/21/2023805.html
以下是笔记:
1 ,改造成Maven项目,这里是pom.xml文件:
2,完整的JsonlibTest.java文件:
3,运行结果:
4,源代码git地址:
http://git.oschina.net/coderdream/json-lib-demo
5,源代码下载:
原文地址:
JSON-lib框架,转换JSON、XML不再困难
http://www.cnblogs.com/hoojo/archive/2011/04/21/2023805.html
以下是笔记:
1 ,改造成Maven项目,这里是pom.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.coderdream</groupId> <artifactId>json-lib-demo</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>json-lib-demo Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>xom</groupId> <artifactId>xom</artifactId> <version>1.2.5</version> </dependency> </dependencies> <build> <finalName>json-lib-demo</finalName> </build> </project>
2,完整的JsonlibTest.java文件:
package com.hoo.test; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import net.sf.json.JSONArray; import net.sf.json.JSONFunction; import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; import net.sf.json.JsonConfig; import net.sf.json.processors.JsonValueProcessor; import net.sf.json.util.PropertyFilter; import net.sf.json.xml.XMLSerializer; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.hoo.entity.Birthday; import com.hoo.entity.Student; /** * <b>function:</b> 用json-lib转换java对象到JSON字符串 读取json字符串到java对象,序列化jsonObject到xml json-lib-version: * json-lib-2.3-jdk15.jar 依赖包: commons-beanutils.jar commons-collections-3.2.jar ezmorph-1.0.3.jar commons-lang.jar * commons-logging.jar * * @author hoojo * @createDate Nov 28, 2010 2:28:39 PM * @file JsonlibTest.java * @package com.hoo.test * @project WebHttpUtils * @blog http://blog.csdn.net/IBM_hoojo * @email hoojo_@126.com * @version 1.0 */ public class JsonlibTest { private JSONArray jsonArray = null; private JSONObject jsonObject = null; private Student bean = null; @Before public void init() { jsonArray = new JSONArray(); jsonObject = new JSONObject(); bean = new Student(); bean.setAddress("address"); bean.setEmail("email"); bean.setId(1); bean.setName("haha"); Birthday day = new Birthday(); day.setBirthday("2010-11-22"); bean.setBirthday(day); } @After public void destory() { jsonArray = null; jsonObject = null; bean = null; System.gc(); } public final void fail(String string) { System.out.println(string); } public final void failRed(String string) { System.err.println(string); } /* =========================Java Object >>>> JSON String =========================== */ /** * <b>function:</b>转Java Bean对象到JSON * * @author hoojo * @createDate Nov 28, 2010 2:35:54 PM */ @Test public void writeEntity2JSON() { fail("==============Java Bean >>> JSON Object=================="); fail(JSONObject.fromObject(bean).toString()); fail("==============Java Bean >>> JSON Array=================="); fail(JSONArray.fromObject(bean).toString());// array会在最外层套上[] fail("==============Java Bean >>> JSON Object =================="); fail(JSONSerializer.toJSON(bean).toString()); fail("========================JsonConfig========================"); JsonConfig jsonConfig = new JsonConfig(); jsonConfig.registerJsonValueProcessor(Birthday.class, new JsonValueProcessor() { public Object processArrayValue(Object value, JsonConfig jsonConfig) { if (value == null) { return new Date(); } return value; } public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) { fail("key:" + key); return value + "##修改过的日期"; } }); jsonObject = JSONObject.fromObject(bean, jsonConfig); fail(jsonObject.toString()); Student student = (Student) JSONObject.toBean(jsonObject, Student.class); fail(jsonObject.getString("birthday")); fail(student.toString()); fail("#####################JsonPropertyFilter############################"); jsonConfig.setJsonPropertyFilter(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { fail(source + "%%%" + name + "--" + value); // 忽略birthday属性 if (value != null && Birthday.class.isAssignableFrom(value.getClass())) { return true; } return false; } }); fail(JSONObject.fromObject(bean, jsonConfig).toString()); fail("#################JavaPropertyFilter##################"); jsonConfig.setRootClass(Student.class); jsonConfig.setJavaPropertyFilter(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { fail(name + "@" + value + "#" + source); if ("id".equals(name) || "email".equals(name)) { value = name + "@@"; return true; } return false; } }); // jsonObject = JSONObject.fromObject(bean, jsonConfig); // student = (Student) JSONObject.toBean(jsonObject, Student.class); // fail(student.toString()); student = (Student) JSONObject.toBean(jsonObject, jsonConfig); fail("Student:" + student.toString()); } /** * <b>function:</b>转换Java List集合到JSON * * @author hoojo * @createDate Nov 28, 2010 2:36:15 PM */ @Test public void writeList2JSON() { fail("==============Java List >>> JSON Array=================="); List<Student> stu = new ArrayList<Student>(); stu.add(bean); bean.setName("jack"); stu.add(bean); fail(JSONArray.fromObject(stu).toString()); fail(JSONSerializer.toJSON(stu).toString()); } /** * <b>function:</b>转Java Map对象到JSON * * @author hoojo * @createDate Nov 28, 2010 2:37:35 PM */ @Test public void writeMap2JSON() { Map<String, Object> map = new HashMap<String, Object>(); map.put("A", bean); bean.setName("jack"); map.put("B", bean); map.put("name", "json"); map.put("bool", Boolean.TRUE); map.put("int", new Integer(1)); map.put("arr", new String[] { "a", "b" }); map.put("func", "function(i){ return this.arr[i]; }"); fail("==============Java Map >>> JSON Object=================="); fail(JSONObject.fromObject(map).toString()); fail("==============Java Map >>> JSON Array =================="); fail(JSONArray.fromObject(map).toString()); fail("==============Java Map >>> JSON Object=================="); fail(JSONSerializer.toJSON(map).toString()); } /** * <b>function:</b> 转换更多数组类型到JSON * * @author hoojo * @createDate Nov 28, 2010 2:39:19 PM */ @Test public void writeObject2JSON() { String[] sa = { "a", "b", "c" }; fail("==============Java StringArray >>> JSON Array =================="); fail(JSONArray.fromObject(sa).toString()); fail(JSONSerializer.toJSON(sa).toString()); fail("==============Java boolean Array >>> JSON Array =================="); boolean[] bo = { true, false, true }; fail(JSONArray.fromObject(bo).toString()); fail(JSONSerializer.toJSON(bo).toString()); Object[] o = { 1, "a", true, 'A', sa, bo }; fail("==============Java Object Array >>> JSON Array =================="); fail(JSONArray.fromObject(o).toString()); fail(JSONSerializer.toJSON(o).toString()); fail("==============Java String >>> JSON =================="); fail(JSONArray.fromObject("['json','is','easy']").toString()); fail(JSONObject.fromObject("{'json':'is easy'}").toString()); fail(JSONSerializer.toJSON("['json','is','easy']").toString()); fail("==============Java JSONObject >>> JSON =================="); jsonObject = new JSONObject().element("string", "JSON").element("integer", "1").element("double", "2.0") .element("boolean", "true"); fail(JSONSerializer.toJSON(jsonObject).toString()); fail("==============Java JSONArray >>> JSON =================="); jsonArray = new JSONArray().element("JSON").element("1").element("2.0").element("true"); fail(JSONSerializer.toJSON(jsonArray).toString()); fail("==============Java JSONArray JsonConfig#setArrayMode >>> JSON =================="); List<String> input = new ArrayList<String>(); input.add("JSON"); input.add("1"); input.add("2.0"); input.add("true"); JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON(input); JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setArrayMode(JsonConfig.MODE_OBJECT_ARRAY); Object[] output = (Object[]) JSONSerializer.toJava(jsonArray, jsonConfig); System.out.println(output[0]); fail("==============Java JSONFunction >>> JSON =================="); String str = "{'func': function( param ){ doSomethingWithParam(param); }}"; JSONObject jsonObject = (JSONObject) JSONSerializer.toJSON(str); JSONFunction func = (JSONFunction) jsonObject.get("func"); fail(func.getParams()[0]); fail(func.getText()); } private String json = "{\"address\":\"chian\",\"birthday\":{\"birthday\":\"2010-11-22\"}," + "\"email\":\"email@123.com\",\"id\":22,\"name\":\"tom\"}"; @SuppressWarnings("unchecked") @Test public void readJSON2Collection() { try { fail("==============JSON Arry String >>> Java Collection =================="); json = "[" + json + "]"; jsonArray = JSONArray.fromObject(json); Collection<Student> con = JSONArray.toCollection(jsonArray, Student.class); System.out.println(con.size()); Object[] stt = con.toArray(); System.out.println(stt.length); fail(stt[0].toString()); } catch (Exception e) { e.printStackTrace(); } } @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void readJSON2Map() { try { fail("==============JSON Arry String >>> Java Map =================="); json = "{\"arr\":[\"a\",\"b\"],\"A\":{\"address\":\"address\",\"birthday\":{\"birthday\":\"2010-11-22\"}," + "\"email\":\"email\",\"id\":1,\"name\":\"jack\"},\"int\":1," + "\"B\":{\"address\":\"address\",\"birthday\":{\"birthday\":\"2010-11-22\"}," + "\"email\":\"email\",\"id\":1,\"name\":\"jack\"},\"name\":\"json\",\"bool\":true}"; jsonObject = JSONObject.fromObject(json); Map<String, Class<?>> clazzMap = new HashMap<String, Class<?>>(); clazzMap.put("arr", String[].class); clazzMap.put("A", Student.class); clazzMap.put("B", Student.class); Map<String, ?> mapBean = (Map) JSONObject.toBean(jsonObject, Map.class, clazzMap); System.out.println(mapBean); Set<String> set = mapBean.keySet(); Iterator<String> iter = set.iterator(); while (iter.hasNext()) { String key = iter.next(); fail(key + ":" + mapBean.get(key).toString()); } } catch (Exception e) { e.printStackTrace(); } } /* ============================Java Object >>>>> XML ========================== */ /** * <b>function:</b> 转换Java对象到XML 需要额外的jar包:xom.jar * * @author hoojo * @createDate Nov 28, 2010 2:39:55 PM */ @Test public void writeObject2XML() { XMLSerializer xmlSerializer = new XMLSerializer(); fail("==============Java String Array >>> XML =================="); // xmlSerializer.setElementName("bean"); fail(xmlSerializer.write(JSONArray.fromObject(bean))); String[] sa = { "a", "b", "c" }; fail("==============Java String Array >>> XML =================="); fail(xmlSerializer.write(JSONArray.fromObject(sa))); fail("==============Java boolean Array >>> XML =================="); boolean[] bo = { true, false, true }; fail(xmlSerializer.write(JSONArray.fromObject(bo))); fail(xmlSerializer.write(JSONSerializer.toJSON(bo))); Object[] o = { 1, "a", true, 'A', sa, bo }; fail("==============Java Object Array >>> JSON Array =================="); fail(xmlSerializer.write(JSONArray.fromObject(o))); fail(xmlSerializer.write(JSONSerializer.toJSON(o))); fail("==============Java String >>> JSON =================="); fail(xmlSerializer.write(JSONArray.fromObject("['json','is','easy']")).toString()); fail(xmlSerializer.write(JSONObject.fromObject("{'json':'is easy'}")).toString()); fail(xmlSerializer.write(JSONSerializer.toJSON("['json','is','easy']")).toString()); } /* ============================XML String >>>>> Java Object ========================== */ /** * <b>function:</b>转换xml文档到java对象 * * @author hoojo * @createDate Nov 28, 2010 3:00:27 PM */ @Test public void readXML2Object() { XMLSerializer xmlSerializer = new XMLSerializer(); fail("============== XML >>>> Java String Array =================="); String[] sa = { "a", "b", "c" }; jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONArray.fromObject(sa))); fail(jsonArray.toString()); String[] s = (String[]) JSONArray.toArray(jsonArray, String.class); fail(s[0].toString()); fail("============== XML >>>> Java boolean Array =================="); boolean[] bo = { true, false, true }; jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONArray.fromObject(bo))); bo = (boolean[]) JSONArray.toArray(jsonArray, boolean.class); fail(bo.toString()); System.out.println(bo[0]); jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONSerializer.toJSON(bo))); bo = (boolean[]) JSONArray.toArray(jsonArray, boolean.class); fail(bo.toString()); System.out.println(bo[0]); fail("==============Java Object Array >>> JSON Array =================="); Object[] o = { 1, "a", true, 'A', sa, bo }; jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONArray.fromObject(o))); System.out.println(jsonArray.getInt(0)); System.out.println(jsonArray.get(1)); System.out.println(jsonArray.getBoolean(2)); jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONSerializer.toJSON(o))); System.out.println(jsonArray.get(4)); System.out.println(jsonArray.getJSONArray(5).get(0)); System.out.println(jsonArray.get(5)); fail("==============Java String >>> JSON =================="); jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONArray.fromObject("['json','is','easy']")) .toString()); s = (String[]) JSONArray.toArray(jsonArray, String.class); fail(s[0].toString()); jsonObject = (JSONObject) xmlSerializer.read(xmlSerializer.write(JSONObject.fromObject("{'json':'is easy'}")) .toString()); Object obj = JSONObject.toBean(jsonObject); System.out.println(obj); jsonArray = (JSONArray) xmlSerializer.read(xmlSerializer.write(JSONSerializer.toJSON("['json','is','easy']")) .toString()); s = (String[]) JSONArray.toArray(jsonArray, String.class); fail(s[1].toString()); } @Test public void testReadXml2Array() { String str = "<a class=\"array\">" + "<e type=\"function\" params=\"i,j\">" + "return matrix[i][j];" + "</e>" + "</a>"; JSONArray json = (JSONArray) new XMLSerializer().read(str); fail(json.toString()); } }
3,运行结果:
==============Java Map >>> JSON Object================== {"arr":["a","b"],"A":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"int":1,"B":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"name":"json","func":function(i){ return this.arr[i]; },"bool":true} ==============Java Map >>> JSON Array ================== [{"arr":["a","b"],"A":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"int":1,"B":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"name":"json","func":function(i){ return this.arr[i]; },"bool":true}] ==============Java Map >>> JSON Object================== {"arr":["a","b"],"A":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"int":1,"B":{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},"name":"json","func":function(i){ return this.arr[i]; },"bool":true} ==============JSON Arry String >>> Java Map ================== {A=jack#1#address#2010-11-22#email, arr=[a, b], B=jack#1#address#2010-11-22#email, int=1, name=json, bool=true} A:jack#1#address#2010-11-22#email arr:[a, b] B:jack#1#address#2010-11-22#email int:1 name:json bool:true ==============Java String Array >>> XML ================== <?xml version="1.0" encoding="UTF-8"?> <a><e class="object"><address type="string">address</address><birthday class="object"><birthday type="string">2010-11-22</birthday></birthday><email type="string">email</email><id type="number">1</id><name type="string">haha</name></e></a> ==============Java String Array >>> XML ================== <?xml version="1.0" encoding="UTF-8"?> <a><e type="string">a</e><e type="string">b</e><e type="string">c</e></a> ==============Java boolean Array >>> XML ================== <?xml version="1.0" encoding="UTF-8"?> <a><e type="boolean">true</e><e type="boolean">false</e><e type="boolean">true</e></a> <?xml version="1.0" encoding="UTF-8"?> <a><e type="boolean">true</e><e type="boolean">false</e><e type="boolean">true</e></a> ==============Java Object Array >>> JSON Array ================== <?xml version="1.0" encoding="UTF-8"?> <a><e type="number">1</e><e type="string">a</e><e type="boolean">true</e><e type="string">A</e><e class="array"><e type="string">a</e><e type="string">b</e><e type="string">c</e></e><e class="array"><e type="boolean">true</e><e type="boolean">false</e><e type="boolean">true</e></e></a> <?xml version="1.0" encoding="UTF-8"?> <a><e type="number">1</e><e type="string">a</e><e type="boolean">true</e><e type="string">A</e><e class="array"><e type="string">a</e><e type="string">b</e><e type="string">c</e></e><e class="array"><e type="boolean">true</e><e type="boolean">false</e><e type="boolean">true</e></e></a> ==============Java String >>> JSON ================== <?xml version="1.0" encoding="UTF-8"?> <a><e type="string">json</e><e type="string">is</e><e type="string">easy</e></a> <?xml version="1.0" encoding="UTF-8"?> <o><json type="string">is easy</json></o> <?xml version="1.0" encoding="UTF-8"?> <a><e type="string">json</e><e type="string">is</e><e type="string">easy</e></a> ==============Java Bean >>> JSON Object================== {"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"haha"} ==============Java Bean >>> JSON Array================== [{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"haha"}] ==============Java Bean >>> JSON Object ================== {"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"haha"} ========================JsonConfig======================== key:birthday {"address":"address","birthday":"2010-11-22##修改过的日期","email":"email","id":1,"name":"haha"} 八月 08, 2015 5:22:46 下午 net.sf.json.JSONObject morphPropertyValue 警告: Can't transform property 'birthday' from java.lang.String into com.hoo.entity.Birthday. Will register a default Morpher 八月 08, 2015 5:22:46 下午 net.sf.ezmorph.bean.BeanMorpher morph 警告: Property 'java.lang.String.birthday' does not exist. SKIPPED. 八月 08, 2015 5:22:46 下午 net.sf.ezmorph.bean.BeanMorpher morph 信息: Property 'com.hoo.entity.Birthday.class' has no write method. SKIPPED. 2010-11-22##修改过的日期 haha#1#address#null#email #####################JsonPropertyFilter############################ haha#1#address#2010-11-22#email%%%address--address haha#1#address#2010-11-22#email%%%birthday--2010-11-22 haha#1#address#2010-11-22#email%%%email--email haha#1#address#2010-11-22#email%%%id--1 haha#1#address#2010-11-22#email%%%name--haha {"address":"address","email":"email","id":1,"name":"haha"} #################JavaPropertyFilter################## address@address#null#0#null#null#null birthday@2010-11-22##修改过的日期#null#0#address#null#null 八月 08, 2015 5:22:46 下午 net.sf.ezmorph.bean.BeanMorpher morph 警告: Property 'java.lang.String.birthday' does not exist. SKIPPED. 八月 08, 2015 5:22:46 下午 net.sf.ezmorph.bean.BeanMorpher morph 信息: Property 'com.hoo.entity.Birthday.class' has no write method. SKIPPED. email@email#null#0#address#null#null id@1#null#0#address#null#null name@haha#null#0#address#null#null Student:haha#0#address#null#null ==============Java StringArray >>> JSON Array ================== ["a","b","c"] ["a","b","c"] ==============Java boolean Array >>> JSON Array ================== [true,false,true] [true,false,true] ==============Java Object Array >>> JSON Array ================== [1,"a",true,"A",["a","b","c"],[true,false,true]] [1,"a",true,"A",["a","b","c"],[true,false,true]] ==============Java String >>> JSON ================== ["json","is","easy"] {"json":"is easy"} ["json","is","easy"] ==============Java JSONObject >>> JSON ================== {"string":"JSON","integer":"1","double":"2.0","boolean":"true"} ==============Java JSONArray >>> JSON ================== ["JSON","1","2.0","true"] ==============Java JSONArray JsonConfig#setArrayMode >>> JSON ================== JSON ==============Java JSONFunction >>> JSON ================== param doSomethingWithParam(param); ==============JSON Arry String >>> Java Collection ================== 1 1 tom#22#chian#2010-11-22#email@123.com ============== XML >>>> Java String Array ================== 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string ["a","b","c"] a ============== XML >>>> Java boolean Array ================== 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string [Z@59930b4b true 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string [Z@44ca96de true ==============Java Object Array >>> JSON Array ================== 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string 1 a true 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string ["a","b","c"] true ["true","false","true"] ==============Java String >>> JSON ================== 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string json 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string net.sf.ezmorph.bean.MorphDynaBean@4436f0c9[ {json=is easy} ] 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string is 八月 08, 2015 5:22:47 下午 net.sf.json.xml.XMLSerializer getType 信息: Using default type string [function(i,j){ return matrix[i][j]; }] ==============Java List >>> JSON Array================== [{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"}] [{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"},{"address":"address","birthday":{"birthday":"2010-11-22"},"email":"email","id":1,"name":"jack"}]
4,源代码git地址:
http://git.oschina.net/coderdream/json-lib-demo
5,源代码下载:
- json-lib-demo.7z (12.7 KB)
- 下载次数: 0
相关推荐
在本文档《json 学习笔记_***.pdf》中,主要介绍了在Java开发中,如何使用三个常用的JSON处理工具:struts json,json_lib,jackson-mapper。同时,也提到了在使用这些工具时可能遇到的一些常见错误及其处理方法。 ...
配置文件都使用XML格式,框架都是用xml和Properties作为配置文件。 1.3. 使用:(掌握) 语法: <?xml version="1.0" encoding="UTF-8"?> <!--注释快捷键:ctrl + shift + / --> <!-- ...
### Struts2框架详解 #### 一、Struts2框架介绍 Struts2是一个基于MVC模式的开源Java Web框架,它提供了丰富的功能用于构建Web应用程序。与Struts1相比,Struts2的设计思想和架构有着根本的不同。Struts2的核心是...
### Apache CXF 学习笔记知识点汇总 #### 一、CXF简介 ##### 1.1 CXF概述 - **背景介绍**:Apache CXF 是一个高性能、功能丰富的开源框架,用于构建和消费 Web 服务。它融合了 Celtix 和 XFire 两个开源项目的...
### Girl项目学习笔记1 #### 一、Spring Boot项目初始化与Maven镜像更换 **1.1 更换IDEA内置Maven镜像至阿里云中央仓库** 在启动Spring Boot项目之前,首先需要确保开发环境配置正确。对于使用IntelliJ IDEA作为...
【描述】: "这份资料集合是关于个人学习AJAX的心得,虽然较为初级且未经过系统的整理,但包含了我学习过程中的笔记和实例,适合初学者入门。" 【标签】: "比较杂乱" 在这些文档和资源中,我们可以提取出以下几个...
这些文件通常用JSON或XML格式,便于程序读取和解析。 "doc"目录则是文档资料,可能包括API参考、设计文档、开发者笔记等。对于其他开发者或维护者来说,这些文档是理解和修改游戏代码的关键。Cocos2D-x提供了丰富的...
【Solr学习心得与总结笔记】 一、站内搜索的技术选型 站内搜索的实现方式多样,但针对不同需求,技术选型有所不同: 1. 使用Lucene:Lucene是Java开发的全文检索库,提供了底层的搜索算法,但直接使用Lucene需要...
在本篇Java中jqGrid的学习笔记整理中,我们将聚焦于jqGrid与后台Java服务的数据交互。jqGrid是一款强大的JavaScript库,用于创建动态、交互式的表格,而这里的进阶篇(二)将涉及到如何通过Java后端来提供数据支持。 ...
3. **jqgrid学习笔记网搜和个人经验1.pdf**:作者通过网络搜集和自己的实践,整理出的学习笔记,包含了常见问题解决方案和实践经验分享,对于初学者极具参考价值。 **总结** jgGrid作为一个强大的JavaScript表格...
3. **资源文件**:包括游戏的图像、音频、字体等,通常为`.png`、`.jpg`、`.wav`、`.mp3`等格式,有时会包含`.xml`或`.json`等用于描述资源的元数据文件。 4. **配置文件**:`.txt`或`.ini`等格式,存储游戏设置和...
8. **模式(Schemas)**:使用JSON Schema或XML Schema定义数据结构,确保输入和输出的数据格式正确。 **"raml-example-master"目录结构** 在解压后的"raml-example-master"文件夹中,我们可能会找到以下内容: 1...
3. **样式表或布局文件**:`.css`, `.xml` 或其他格式,定义UI的外观和布局,比如颜色、字体、按钮大小等。 4. **配置文件**:`.json`, `.ini`, `.config` 等,用于设置应用的运行参数或特定环境的配置。 5. **...