Servlet and XML

Servlet to dislay Xml Content


import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class NewServlet extends HttpServlet {

   
    
    public void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/xml");
       PrintWriter out = response.getWriter();
            
            out.println("<table border='1'><tr>");
            out.println("<th>celebrity</th>");
            out.println("<th>profession</th>");
            out.println("<tr><td>sachin</td></tr>");
            out.println("<td>ccricketer</td>");
            out.println("<tr><td>dulquer salman</td></tr>");
            out.println("<td>hero</td>");
            out.println("<tr><td>federer</td></tr>");
            out.println("<td>tennis star</td></tr></table>");
                                   out.close();
        }
    }

Comments

Popular posts from this blog

Java Beans Program

MACHINE LEARNING IN REAL WORLD

MACHINE LEARNING INTRODUCTION