Servlet/ html problem

hi all,
I have the situation where the result of an end user's actions is a variable length (in terms of number of rows) HTML table. How can the JSP/Servlet be designed so that the Servlet (or elsewhere in the non-presentation logic) doesn't generate HTML?
thanks in advance.....

Hi,
The jsp can make a call to some class/object that may return a variable length list (like vector). the jsp code look like this :
code:
<table><%Vector nameVector = SomeObject.getNameVector(param);for (int index=0;index<nameVector.size();index++){%><TR><TD><%=(String) nameVector.get(index)%></tr></td><%}%></table>
hope this will help you.
Anil.
Developer Technical support
Sun Microsystems, India.
http://www.sun.com/developers/support

Similar Messages

  • Servlet Compilation Problem !

    Hi,
    I am just starting to learn servlets and I got problem in compiling them. I got compilation error in
    import javax.servlet.*;statement. Seems that the compiler cannot find the servlet package. I got J2EE 1.4 beta installed on my machine but there is no servlet.jar package. I am using J2SDK 1.4.1_02, J2EE 1.4 beta and Tomcat 4.1.24.
    Can anyone help me with my servlet compilation problem?
    Thanks in advance!
    Josh

    servlet.jar is here :
    <tomcatdir>\common\lib
    add it to your compiler classpath

  • Servlet chaining problem..

    import java.io.*;
        import javax.servlet.*;
        import javax.servlet.http.*;
        public class Deblink extends HttpServlet {
          public void doGet(HttpServletRequest req, HttpServletResponse res)
                                       throws ServletException, IOException {
            String contentType = req.getContentType();  // get the incoming type
            if (contentType == null) return;  // nothing incoming, nothing to do
            res.setContentType(contentType);  // set outgoing type to be incoming type
            PrintWriter out = res.getWriter();
            BufferedReader in = req.getReader();
            String line = null;
            while ((line = in.readLine()) != null) {
              line = replace(line, "<BLINK>", "");
              line = replace(line, "</BLINK>", "");
              out.println(line);
          public void doPost(HttpServletRequest req, HttpServletResponse res)
                                        throws ServletException, IOException {
            doGet(req, res);
          private String replace(String line, String oldString, String newString) {
            int index = 0;
            while ((index = line.indexOf(oldString, index)) >= 0) {
              // Replace the old string with the new string (inefficiently)
              line = line.substring(0, index) +
                     newString +
                     line.substring(index + oldString.length());
              index += newString.length();
            return line;
    What is pre request fo above code to work.
    I had tried this many time but it is not working, what will be calling servlet look like

    And can you explain why your title is "Servlet chaining problem"?

  • How to create ShoppingCart By Using mysql+Servlet+Html

    Hi everyone:
    I am working on a project using Jbuilder, which is a shopping site.
    The functions are:
    1, Access database and display all kinds of products in a table
    2, Add the item you want into a Temporary Cart
    3, Remove unwanted items from cart
    4, Confirm the order
    I can only use mysql + Servlet + Html.
    I am at the step of display everything from the database, but i don't have any idea how to do the rest of the functions.
    i have read lots of information, it seems that i need to use session tracking, and connection pool stuff.
    Can any one give me some suggestions about how to design this project and how to implement it, and what kinds of thing i need to aware of.
    cheers
    Lin

    Hi,
    i have idea about ur app in different env i.e. in different servers but i don't know how it will impl in jbuilder.i will send u link of whole shop app and also u can refer the wrox books and site.

  • Send html problems

    Hello,
    I need help with my problem, this is part of my procedure that will send mail
    c := utl_smtp.open_connection(server);
    utl_smtp.helo(c, domena);
    utl_smtp.mail(c, posilja);
    utl_smtp.rcpt(c, prejemnik);
    utl_smtp.open_data(c);
    send_header('From', '<' || posilja || '>');
    send_header('To', '<' || prejemnik || '>');
    IF posljicc is not null THEN
         send_header('Cc', '<' || posljicc || '>');
         poslji_mail(posljicc, null, zadeva, posta);
    END IF;
    send_header('Subject', zadeva);
    send_header('MIME-Version', '1.0' || utl_tcp.CRLF);
    send_header('Content-Type', 'text/html' || utl_tcp.CRLF); <----- PROBLEM
    utl_smtp.write_data(c, utl_tcp.CRLF || posta);
    utl_smtp.close_data(c);
    utl_smtp.quit(c);...
    and it works fine but when I want to send HTML mail I see mail in code not as html like this:
    Content-Type: text/html <------- this should be in header
    <HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1250"></HEAD><BODY><table><tr><td>1</td><td>2</td></tr><tr><td>1</td></tr><tr><td>1</td><td>2</td><td>3</td></tr></table></body></html>
    Problem is that I see mail as text and I also see this in text body "Content-Type: text/html", but this should be in header.
    Can anyone help me with my problem, what must I do to get the html mail (not as text)?
    Thanks for your help

    Thanks I have solved the problem

  • Java Servlet/Html link problem

    Hi,
    I have been using the Java servlet to create the html code itself using the PrintWriter.I would like to know if it possible to input ALL the code into -
    PrintWriter out=null;
    out.println("<Html><Body>the entrie html code</Body></Html>");
    or must I input in this form?-
    out.println("<html>");
    out.println("<Body>");
    out.println("<The entire html code>");
    out.println("</Body>");
    out.println("</Html>");
    Does it really make a difference?
    I would also like to know it is possible to retrive data from a database and (via servlet) input the list of data into the combo-box of an html Webpage.
    Thank you very much for your assistance.Kindly acknowledge receipt.
    Yours sincerely,
    Aeshan
    PS- I'll send more information soon

    Your answers are yes ...and yes.
    But don't use:
    PrintWriter out=null;
    Use:
    PrintWriter out = response.getWriter();
    Usually the println() method is used to make both the servlet source code ...as well as the html it generates ...a little nicer to read. This may or may not be important to you, but may matter to your employer and those who maintain your code in the future.

  • Transaction iView - SAP GUI for HTML - Problem while hiding menu bar

    Hello all,
    I am trying to hide the OKcode field and the Menu button in a Transaction iView of type SAP GUI for HTML. I am following the SAP note 1010519. However, nothing seems to change, even after adding the parameter ~webgui_simple_toolbar = 0 or any other value.
    I added the parameter to the service: default_host ->sap -> bc -> gui ->sap -> its -><b>webgui</b>
    After going through few posts relating to this issue, I figured out that passing application parameters would not work. Also, using IAC is not an option for me.
    Can someone help? How can I hide the OKCode field and Menu bar?
    Thanks and Regards,
    Reena

    Hello Reena,
    Maintaining the parameter
    ~WEBTRANSACTIONTYPE   EWT
    will solve your problem. You can also create an IAC iview. Here is a document for the same.
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/_d-f/Displaying%20SAP%20Transaction%20as%20Internet%20Application%20in%20Portal.pdf">How to diplay a transaction as IAC iview</a>
    Also remove the parameter ~noheaderOkCode.
    Hope that helps.
    Regards
    Deb

  • How to send Oracle rowid to servlet? | Problem with national characters.

    There is same possibility how to send rowid to servlet?
    I have now definition like this:
    <af:image source="/imageservlet?Par1=#{bindings.Col1.inputValue}"/>
    But If column contents national characters, servlet methods obtained changed these characters.
    My idea is to use not primary key for row, but use oracle rowid. It is simply possible?
    Use something like this:
    <af:image source="/imageservlet?Rowid=#{bindings.Rowid}"/
    Or Do you have ideas how to solve problem with national characters ?
    Thanks
    FiL

    Hi,
    Although your workaround works.
    I think this is a simple encoding problem.
    I simply need to make sure all parameters and pages are encoded with a char set which contains the national characters you mentioned.
    This is a bit dependent on the exact technology your using, but most can be done via the web.xml:
      <jsp-config>
          <jsp-property-group>
              <url-pattern>*.jsp</url-pattern>
              <page-encoding>UTF-8</page-encoding>
          </jsp-property-group>
      </jsp-config>     This forces all JSP pages to be encoded in UTF-8
    Adding the following parameter sometimes helps as well, although I think this one is a bit dated:
    You said your using a servlet so your servlet needs a similar block for its pattern
      <context-param>
        <param-name>PARAMETER_ENCODING</param-name>
        <param-value>UTF-8</param-value>
      </context-param>If you want to be 100% sure the encoding is set right make sure thepages contain:
    <%@ page contentType="text/html;charset=utf-8"%>Or depending on your view technology the syntax can be a bit different
    -Anton

  • Servlet configuration problems ..

    Hi
    I am a new member starting with Java Servlets:
    I have a problem with Configuring the Servlet on the J2EE Application server.
    Here is the Servlet code ...
    package mypackage;
    public class ShowParameters extends HttpServlet {
        public void doGet(HttpServletRequest request, HttpServletResponse response)         throws ServletException, IOException { .... }And this is the web.xml file
        <servlet>
            <servlet-name>ShowParameters</servlet-name>
            <servlet-class>mypackage.ShowParameters</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>ShowParameters</servlet-name>
            <url-pattern>/ShowParameters</url-pattern>
        </servlet-mapping>And the HTML file is ....
    <FORM ACTION="ShowParameters">
        First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
        Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
        Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
        <CENTER>
            <INPUT TYPE="SUBMIT">
        </CENTER>
    </FORM>I have set the CLASSPATH variable t /build/mypackage/
    I get two erros:
    Wrapper cannot find servlet class ..
    ClassNotFound exception ...
    Also, how do I compile " the servlet class file with the line; package hello; " with the package name
    I would appreciate any help ..
    Thanks
    N

    I am trying to invoke a servlet from an HTML page.
    Method 1
        <FORM ACTION="ThreeParams" METHOD="GET">
            First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
               <CENTER>
            <INPUT TYPE="SUBMIT">
        </CENTER>
        </FORM>Method 2
    <td><a href="Threeparams">Execute</a></td>Method 1 does not work but Method 2 does. But Method 2 does not transmit param1 to the server.
    Any thought on how to get it correct?
    Rgds
    N

  • Servlet intercommunication problem

    Hi,
    I have a problem regarding servlet intercommunication.
    What I m doing is : I have an HTML form in which user enters some data and submits it. Servlet_1 is called , it gets all the parameters and displays all data in the form of an html form again. Now, if the user clicks on "SAVE" button , only then Servlet_2 should get called and that data should be stored in database .
    I m having problem while saving data.I just lose track of data entered by the user somewhere between the servlets.
    How should I get the data enetered by the user previously, and in what form I should store it to access it later on through any servlet?
    Please help.
    Regards
    Shweta

    I suggest other than showing the data on the HTML returned by Servlet_1, you created hidden values of the data submitted into the displayed form. In this way, the data would be resent to Servlet_2 when Save is pressed.
    Alternatively, you can use a Session to store the contents of the submitted information. (this will enable you to access it later on any servlet)

  • Servlet/applet problem

    hi guys
    my problem is that, i started my tomcat server, also my servlet. this servlet should call an applet. so here are my questions:
    where must be the applet class file?
    how looks like my codebase?
    what code must i type into the servlet? something special?
    do i need an apache server additional?
    yes? where must be my files? :)
    hope anyone can help me...
    bye

    keep the applet class file in the home directory, the directory in which your index.html lies, index.html -- the html which shows up when you say http://localhost:8080
    and then give the applet description like this in the servlet
    out.println("<applet code=\"myApplet.class\" codebase=\"http://localhost:8080\" width=\"400\" height=\"400\"> ");
    out.println("</applet>");
    and that should work and you will be good to go

  • Servlet RequestDispatch problem

    I am using RequestDispatch to pass control from one servlet to another. My problem is that when I forward the request...
    It passes control to the next servlet which executes all the way through. But then passes control back to the calling servlet which executes the rest of its code from the forward method call and the first servlet is the one that outputs HTML. What am I doing wrong. I don't want the first servlet to regain control..
    RequestDispatcher dispatcher = m_request.getRequestDispatcher(url);
    dispatcher.forward(req,res);

    Do you want RequestDispatcher.forward() to act like System.exit()? I.E., the thread that is called is terminated? If you want the servlet calling forward NOT to execute after the call to forward then return after the forward is complete. Remember that you are forwarding the request, not (necessarily) the thread, so execution of your method will continue unless you explicitly exit.

  • Jsp-servlet-bean problem

    Please help!
    I have a servlet controller, a javabean for the data and a jsp for the view.
    I cannot get the jsp using
    <jsp:useBean id="pList" class="bbs.PostListCommand" scope="request" />
    to access the bean data
    However, when I access the bean in this way
    <%@ page import="bbs.PostListCommand" %>
    // html
    <% bbs.PostListCommand postList = null;
    synchronized(session){
         postList = (bbs.PostListCommand) session.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
    // etc
    � it works
    Does anyone know why the <jsp:useBean> tag does not find the bean
    I have installed tomcat 4.18 and set the environmental variables etc.
    Directory structure is
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    Thanks in advance for any help.
    Chris

    GrayMan - Thanks for your help.
    Let me explain my problem in more detail ...
    Background:
    I have some servlet experience, but I am new to jsp - so sorry if this seems trivial to you ...
    I have a book called bitter java by bruce tate from manning.com . I am trying to get the chapter 3 examples to work
    There are three files
    PostListCommand          the bean
    PostListController     the servlet
    PostListResults          jsp
    And a new test file � PostListResults version 2 with scriptlet code to access the bean.
    There are a couple of typos in the downloaded source files, but nothing that causes the main problem of not being able to access the bean data.
    Program flow
    Servlet instantiates new bean
    Bean � gets data from db
    Servlet passes bean to jsp with a forward
    Jsp outputs data
    I have put the files in the directories �
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    The complete source code for each file is given below.
    1 I have checked the db access � that�s ok
    2 I have also checked reading the bean data back in from the request scope and printing out the results from within the servlet.- ok
    3 I can access the data through a scriptlet (PostListResults version 2), but not with the original PostListResults which uses <jsp:useBean>
    thanks in advance, chris
    PostListController.java
    package bbs;
    // Imports
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    // Import for commands used by this class
    import bbs.PostListCommand;
    public class PostListController
    extends javax.servlet.http.HttpServlet
    implements Serializable {
    * DoGet
    * Pass get requests through to PerformTask
    public void doGet(
    HttpServletRequest request,
    HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    performTask(request, response);
    public void performTask(
    HttpServletRequest request,
    HttpServletResponse response) {
    try {
    PostListCommand postList = (bbs.PostListCommand) java.beans.Beans.instantiate(getClass().getClassLoader(),"bbs.PostListCommand");
    postList.initialize();
    postList.execute();
    request.setAttribute("PostListCommand", postList);
    ServletContext sc = this.getServletContext();
    RequestDispatcher rd =
    sc.getRequestDispatcher("/jsp/PostListResults.jsp");
    rd.forward(request, response);
    } catch (Throwable theException) {
    theException.printStackTrace();
    PostListCommand.java
    package bbs;
    import java.io.*;
    import java.sql.*;
    //import COM.ibm.db2.jdbc.*;
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (07/17/2001 5:07:55 PM)
    * @author: Administrator
    public class PostListCommand {
    // Field indexes for command properties     
    private static final int SUBJECT_COLUMN = 1;
    private static final int AUTHOR_COLUMN = 2;
    private static final int BOARD_COLUMN = 3;
    protected Vector author = new Vector();
    protected Vector subject = new Vector();
    protected Vector board = new Vector();
    // SQL result set
    protected ResultSet result;
    protected Connection connection = null;
    * execute
    * This is the work horse method for the command.
    * It will execute the query and get the result set.
    public void execute()
    throws
    java.lang.Exception,
    java.io.IOException {
    try {
    // retrieve data from the database
    Statement statement = connection.createStatement();
    result =
    statement.executeQuery("SELECT subject, author, board from posts");
    while (result.next()) {
    subject.addElement(result.getString(SUBJECT_COLUMN));
    author.addElement(result.getString(AUTHOR_COLUMN));
    board.addElement(result.getString(BOARD_COLUMN));
    result.close();
    statement.close();
    } catch (Throwable theException) {
    theException.printStackTrace();
    * getAuthor
    * This method will get the author property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getAuthor(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) author.elementAt(index);
    * getBoard
    * This method will get the board property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getBoard(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) board.elementAt(index);
    * getSubject
    * This method will get the subject property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getSubject(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) subject.elementAt(index);
    * initialize
    * This method will connect to the database.
    public void initialize()
    throws java.io.IOException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    // URL is jdbc:db2:dbname
    String url = "jdbc:db2:board";
    // URL is jdbc:odbc:bitter3board
    String url = "jdbc:odbc:bitter3board";
    // connect with default id/password
    connection = DriverManager.getConnection(url);
    } catch (Throwable theException) {
    theException.printStackTrace();
    * Insert the method's description here.
    * Creation date: (07/17/2001 11:38:44 PM)
    * @return int
    * @exception java.lang.IndexOutOfBoundsException The exception description.
    public int getSize() {
    return author.size();
    PostListResults.jsp
    <HTML>
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <H1>All Messages</H1>
    <P>
    <jsp:useBean id="postList" class="bbs.PostListCommand" scope="request"></jsp:useBean>
    <TABLE border="1">
    <TR>
    <TD>Subject</TD>
    <TD>Author</TD>
    <TD>Board</TD>
    </TR>
    <% for (int i=0; i < postList.getSize(); _i++) { %>
    <TR> <TD><%=postList.getSubject(_i) %></TD>
    <TD><%=postList.getAuthor(_i) %></TD>
    <TD><%=postList.getBoard(_i) %></TD>
    </TR>
    <% } %>
    </TABLE>
    <P>
    </BODY>
    </HTML>
    PostListResults.jsp version 2 � with scriplet code instead of useBean
    <HTML>
    <%@ page import="bbs.PostListCommand" %>
    <!-- This file was generated by the chris -->
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <% bbs.PostListCommand postList = null;
    synchronized(request){
         postList = (bbs.PostListCommand) request.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
              <TR>
              <TD>Subject</TD>
              <TD>Author</TD>
              <TD>Board</TD>
              </TR>
         <% for (int i=0; i < postList.getSize(); _i++) { %>
                   <TR> <TD><%=postList.getSubject(_i) %></TD>
              <TD><%=postList.getAuthor(_i) %></TD>
              <TD><%=postList.getBoard(_i) %></TD>
              </TR>
         <% } %>
              </TABLE>
    <%     }
    }%>
    <P>
    goodnight
    </BODY>
    </HTML>

  • Save servlet html output as jpeg.

    Hello everybody,
    I have a servlet that creates an html page.
    The html consits of information from a database and displays a data sheet with images and text.
    I have been asked if the outputed data sheet can be saved as an image (jpeg).
    Is this possible?
    Thanks.

    I am can of confused how this works
    I know that there is more to do in order to create an
    image.First you have to make a desition, what do you need?
    * if you only want to save a data sheet i think the better solution is a Excel format file, for this yo coul take a look at http://jakarta.apache.org/poi/hssf/index.html
    * if you want to generate a pdf with images, tables, etc. yo should take a look at http://xml.apache.org/fop/
    * if you want to create a custom image i cant help you
    the proces to generate excel isnt dificult but to make a pdf is a little hard. but if you read the documentation and the examples you shouldnt have problems
    Jorge

  • Servlet-html

    How to send values from servlet to html..
    I retrieve values from database using servlet pgm and want to display in textfield...
    do reply
    thx,
    dish

    You welcome to use my code... the syntax is not 100% for i changed table names, field names, etc for copyright purposes... but this is how i did mine
    You will need to change it according to yur program/output
    Create your SQL statement ...
    =======================================================================================================
    String q8="SELECT *     + "from search_projects "
         + "where queried_user_name = '" + g_user_name + "'";
    os.println("<BR><BR><BR>");
    DisplayQuery(q8, res, "view");
    ========================================================================================================
    static String DisplayQuery(String p_sql,HttpServletResponse res, String p_heading_types)
    throws ServletException,IOException
    PrintWriter os=res.getWriter();
    Statement stmt = null;
    String l_error = "";
    try
    stmt = con.createStatement();
    stmt.execute(p_sql);
    ResultSet rs = stmt.getResultSet();
    if (rs != null)
    DispResultSet(rs, res, p_heading_types);
    rs.close();
    return(p_sql);
    catch (Exception e)
    os.println("<BR><BR>EXCEPTION. Unable to execute. If problem persists, please contact");
    os.println(e);
    return("<BR>ERROR3");
    ===================================================================================================
    static void DispResultSet(ResultSet rs, HttpServletResponse res, String p_heading_types)
    throws ServletException,IOException, SQLException
    PrintWriter os=res.getWriter();
    ResultSetMetaData rsmd = rs.getMetaData ();
    int p=0;
    int numCols = rsmd.getColumnCount ();
    if (p_heading_types.equals("view"))
    while (rs.next())
    os.println("<TABLE BORDER=1 COLS=" + numCols + ">");
         os.println("<TR>");
         os.println("<TD>");
    os.println("<TH><FONT color=blue>Id</FONT></TH>");
    os.println("</TD>");
         os.println("<TD>");
    os.print("<FONT color=black>"+rs.getString(1)+"</FONT></TD>");
         os.println("</TD>");
         os.println("</TR>");
         os.println("<TR>");
         os.println("<TD>");
    os.println("<TH><FONT color=blue>Amount</FONT></TH>");
         os.println("</TD>");
         os.println("<TD>");
    os.print("<FONT color=black>"+rs.getString(2)+"</FONT></TD>");
         os.println("</TD>");
         os.println("</TR>");
         os.println("<TR>");
         os.println("<TD>");
    os.println("<TH><FONT color=blue>rings</FONT></TH>");
         os.println("</TD>");
         os.println("<TD>");
    os.print("<FONT color=black>"+rs.getString(3)+"</FONT></TD>");
         os.println("</TD>");
         os.println("</TR>");
         os.println("<TR>");
         os.println("<TD>");
    os.println("<TH><FONT color=blue>Date</FONT></TH>");
         os.println("</TD>");
         os.println("<TD>");
    os.print("<FONT color=black>"+rs.getString(4)+"</FONT></TD>");
         os.println("</TD>");
         os.println("</TR>");
         os.println("<TR>");
         os.println("<TD>");
    os.println("<TH><FONT color=blue>Email</FONT></TH>");
         os.println("</TD>");
         os.println("<TD>");
    os.print("<FONT color=black>"+rs.getString(5)+"</FONT></TD>");
         os.println("</TD>");
         os.println("</TR>");
    os.println("</TABLE>");
    os.println("<BR><BR><BR>");
    p=p+1;
    Thanks
    Naren

Maybe you are looking for