Getting contact list from gmail using jsp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swethak
    New Member
    • May 2008
    • 118

    Getting contact list from gmail using jsp

    hi,

    i have to get the gmail contact list using jsp code. For that purpose i have to use the Google data Api

    Code:
    <%@ page import="com.xdatasystem.contactsimporter.*" %>
    <%
    // automatically guess the correct implementaion based on the email address
    ContactListImporter importer=ContactListImporterFactory.guess("mymail@gmail.com", "mypassword");
    List<Contact> contacts=importer.getContactList();
    for(Contact c : contacts) {
      out.println("name: "+c.getName()+", email: "+c.getEmail());
    }
    %>

    By using like that code i got the errors as


    org.apache.jasp er.JasperExcept ion: Unable to compile class for JSP

    An error occurred at line: 2 in the jsp file: /importcontact.j sp
    Generated servlet error:
    ContactListImpo rter cannot be resolved to a type

    An error occurred at line: 2 in the jsp file: /importcontact.j sp
    Generated servlet error:
    ContactListImpo rterFactory cannot be resolved

    An error occurred at line: 2 in the jsp file: /importcontact.j sp
    Generated servlet error:
    List cannot be resolved to a type

    An error occurred at line: 2 in the jsp file: /importcontact.j sp
    Generated servlet error:
    Contact cannot be resolved to a type


    org.apache.jasp er.servlet.JspS ervletWrapper.h andleJspExcepti on(JspServletWr apper.java:510)
    org.apache.jasp er.servlet.JspS ervletWrapper.s ervice(JspServl etWrapper.java: 375)
    org.apache.jasp er.servlet.JspS ervlet.serviceJ spFile(JspServl et.java:314)
    org.apache.jasp er.servlet.JspS ervlet.service( JspServlet.java :264)
    javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:802)

    We think these are errors comes due to the didn't have the proper jar files.In that i didn't place any jar files in lib folder.

    If these error comes due to jar files please tell that what jar files i have to to place in the lib folder.
    otherwise please tell that whats the problem in my code.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Hey there friend!

    I am not sure if it is a jar file problem, but I can tell you from my own experience using mail (similarly to yours)... An attempt to use Gmail gateway failed, I supposed because Google did not allow me to use their mail server to send mail.

    I suspect you'll need to figure out a way to be allowed into your mail in code, which may mean getting Google's okay.

    Not sure if Gmail gives out their mail gateway info for use.

    Good luck finding it, please post your findings for all to see, if you could:-)

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Originally posted by swethak
      org.apache.jasp er.JasperExcept ion: Unable to compile class for JSP

      An error occurred at line: 2 in the jsp file: /importcontact.j sp
      Generated servlet error:
      ContactListImpo rter cannot be resolved to a type

      An error occurred at line: 2 in the jsp file: /importcontact.j sp
      Generated servlet error:
      ContactListImpo rterFactory cannot be resolved

      An error occurred at line: 2 in the jsp file: /importcontact.j sp
      Generated servlet error:
      List cannot be resolved to a type

      An error occurred at line: 2 in the jsp file: /importcontact.j sp
      Generated servlet error:
      Contact cannot be resolved to a type


      org.apache.jasp er.servlet.JspS ervletWrapper.h andleJspExcepti on(JspServletWr apper.java:510)
      org.apache.jasp er.servlet.JspS ervletWrapper.s ervice(JspServl etWrapper.java: 375)
      org.apache.jasp er.servlet.JspS ervlet.serviceJ spFile(JspServl et.java:314)
      org.apache.jasp er.servlet.JspS ervlet.service( JspServlet.java :264)
      javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:802)

      We think these are errors comes due to the didn't have the proper jar files.In that i didn't place any jar files in lib folder.

      If these error comes due to jar files please tell that what jar files i have to to place in the lib folder.
      I don't really know JSP, but the errors indicate, that you either haven't imported those libraries (I'm guessing you normally have to in JSP just like in normal Java) or that it can indeed not find the jars.

      ContactListImpo rter should be in a jar that should be downloadable here, I could imagine that ContactListImpo rterFactory is in the same jar. List is probably java.util.List and Contact will be in some Google API, I would think.

      Greetings,
      Nepomuk

      Comment

      Working...