Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JSP / Java Problem - Twitter search application

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JSP / Java Problem - Twitter search application

    Hi all,

    I have been given a project to complete to gain the basic skills required for JSP. The app is a twitter search application. The user will type a search term into a textbox on index.jsp and hit search. An ajax call will then be made to another JSP file which calls java classes.

    To search for tweets using the ATOM based search from the twitter api you must use the following url:

    java - Twitter Search

    In my class TwitterSearch I have the following skeleton code:
    import java.util.ArrayList;
     
    public class TwitterSearch {
     
    	//perform the web service call to twitter here returning an ArrayList of Twitter objects
    	public ArrayList<Twitter> search(String query){
    		ArrayList<Twitter> tweets = new ArrayList<Twitter>();
     
    		//do service call - url returns all tweets for subject in XML format
     
    		String url = "http://search.twitter.com/search.atom?q=query";
     
     
    		//get xml results and loop through them and put them into the list
     
    		return tweets;
    	}
    }

    I'm stuck here and do not know how I am going to pass the query to the url and get the code to execute and run the http url.

    Any help would be greatly appreciated!

    Thanks,


  2. #2
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: JSP / Java Problem - Twitter search application

    Well most likely twitter is going to use + instead of space, and besides that you can just use the string instead of query. EG first use String's convenient replaceAll method to replace all " " with "+", and then use "q="+query for the end of the url

Similar Threads

  1. Problem while calling mPlayer from Java application
    By bhavani418 in forum AWT / Java Swing
    Replies: 3
    Last Post: January 28th, 2012, 10:49 PM
  2. Problem with Java Update freezing application
    By banny7 in forum Java Theory & Questions
    Replies: 0
    Last Post: October 25th, 2011, 01:36 PM
  3. search problem
    By farvi_buet in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 8th, 2010, 02:26 PM
  4. Breadth First Search Problem
    By Flash8 in forum Algorithms & Recursion
    Replies: 0
    Last Post: March 14th, 2010, 08:27 PM

Tags for this Thread