I am new for sencha touch. I need to pass json data by using RESTful architectural .But I dun has any Idea how to start it.Can anyone guild me some example? Btw I am using JACKSON library.
Here is my java file - jsonTest.java
package jsonTest;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.codehaus.jackson.JsonEncoding;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import com.sun.xml.internal.bind.api.TypeReference;
public class jsonTest {
private static List<String> countries;
private static List<String> tags;
public static void main(String[] args) {
String data = "Afghanistan, Albania, Algeria, Andorra, Angola, Antigua & Deps,"+
"United Kingdom,United States,Uruguay,Uzbekistan,Vanuatu,Vatican City,Venezuela,Vietnam,Yemen,Zambia,Zimbabwe";
countries = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(data, ",");
//Parse the country CSV list and set as Array
while(st.hasMoreTokens()) {
countries.add(st.nextToken().trim());
}
String strTags = "SharePoint, Spring, Struts, Java, JQuery, ASP, PHP, JavaScript, MySQL, ASP, .NET";
tags = new ArrayList<String>();
StringTokenizer st2 = new StringTokenizer(strTags, ",");
//Parse the tags CSV list and set as Array
while(st2.hasMoreTokens()) {
tags.add(st2.nextToken().trim());
}
}
public List<String> getCountryList(String query) {
String country = null;
query = query.toLowerCase();
List<String> matched = new ArrayList<String>();
for(int i=0; i < countries.size(); i++) {
country = countries.get(i).toLowerCase();
if(country.startsWith(query)) {
matched.add(countries.get(i));
}
}
return matched;
}
public List<String> getTechList(String query) {
String country = null;
query = query.toLowerCase();
List<String> matched = new ArrayList<String>();
for(int i=0; i < tags.size(); i++) {
country = tags.get(i).toLowerCase();
if(country.startsWith(query)) {
matched.add(tags.get(i));
}
}
return matched;
}
}
How can I show the result to my sencha touch project?By using list or panel?