MargaretAlbert 0 Newbie Poster

How do IMPROSYS use Contact Importer JAVA in a JSP page?

<%@ page language="java" contentType="text/html" %>

<% String user = request.getParameter("user"); %>
<% String password = request.getParameter("password"); %>
<% String parser = request.getParameter("parser"); %>
<% String userId = "";%>
<%
if(user == null) user = "";
if(password == null) password = "";
if(parser == null) parser = "AOL"; //default
if( user != null && user.length() > 0
&& password != null && password.length() > 0
&& parser != null && parser.length() > 0
)
{

try
{


userId = user;

userId = user;

if(parser.equals("HOTMAIL"))
userId = user+"@hotmail.com";

improsys.contactimport.common.FourInOne imp = new improsys.contactimport.common.FourInOne(userId, password);;

imp.setType(parser);

imp.doLogin();
if(!imp.isLoggedIn())
throw new Exception("Can not be logged in as " + user + " to " + parser.toLowerCase()+".com with the given password.");

improsys.contactimport.common.Contact al[] = imp.getContacts();
if (al==null)
throw new Exception("Unable to parse contacts for " + user + " at " + parser.toLowerCase()+".com");
%>
<table width="68%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#F2F1F0">
<tr>
<td width="100%">
<table border="0" align="center" cellpadding="2" cellspacing="0">
<tr align="center" bgcolor="#99FFFF">
<td colspan="2"> <font color="#006699" size="2" face="Arial, Helvetica, sans-serif">
<strong><%=parser%> Address Book for <%=user%><br>
</strong> <font face="Verdana, Arial, Helvetica, sans-serif">
Total Address found <%=al.length%> </font> </font> </td>
</tr>
<tr align="center" bgcolor="#99CCFF">
<td width="50%" align="left" style="PADDING-LEFT: 12px"> <font color="#000066" size="2" face="Arial, Helvetica, sans-serif">
<strong>Display Name</strong> </font> </td>
<td width="50%" align="left" bgcolor="#99CCFF" style="PADDING-LEFT: 12px">
<font color="#000066" size="2" face="Arial, Helvetica, sans-serif">
<strong>Email ID</strong> </font>
</td>
</tr>
<%

//show others
for(int i=0; i < al.length; i++)
{
%>
<tr>
<td align="left" style="PADDING-LEFT: 12px">
<%
if(al.getEmailAddress().equals(""))
{
%>

<td align="left" style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<%if(al.getName().equals(""))
out.println("<i>NA</i>");
else
out.println(al.getName());
%>
</font>
</td>
<td style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<%if(al.getEmailAddress().equals(""))
out.println("<i>NA</i>");
else
out.println(al.getEmailAddress());
%>
</font> </td>
</tr>
<%
}//for 1

if(al.length == 0)
{
%>
<tr align="center">
<td colspan="3" style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<em>No Address found.</em> </font> </td>
</tr>
<%
}
}//try
catch(Exception e)
{
out.println("<p><div align=center><strong>"+e.getMessage()+"</strong></div></p>");
}

}//master if
%>
</table>
</table>

-----------------

You may check right now...
http://www.improsys.com:8080/jcon/index.jsp
http://www.improsys.com:8080/jcon/index1.jsp