|
hi monalisa,
ur attached code is completely
wrong, i didn't get exactly what u want to do, but what i understood
accordingly i have modified ur code and i am attaching it with this rpy.
i have tested it using IE 5.0 and i am not
getting any Exception.
rakesh.
| |
| Address.: |
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class mservlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String cname = "";
//String add = "";
// Two temporary strings
String[] name = { "abc","xyz","tmp" };
String[] add = { "add1","add2","add3" };
int cnt = 1;
try
{
//Display the result set as a list
out.println("<HTML><HEAD><TITLE>Moloy's Servlet Demo...</TITLE></HEAD>");
out.println("<BODY>");
out.println("<table width=80% > " +
"<th>Name </th><th>Address</th> " );
// put all ur code in this for loop
// whether ur name and adds are coming from a recordset
// or as input parameters to the servlet, it doesn't affect
// where i have used arrays of name and add , u just insert ur
// data from the recordset
for ( int i = 0; i < 3; i++ ) {
out.println("<tr><td align=center>" + name[i] + "</td><td align=center>" + add[i] + "</td></tr>" );
}
out.println("</BODY></HTML>");
}
catch (Exception e)
{
//out.println("Exception caught: ");
e.printStackTrace();
}
}
}
