Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ex 21
- import java.io.*;
- import java.util.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- public class getinfo extends GenericServlet
- {
- public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException
- {
- ServletContext context = getServletContext();
- PrintWriter out = res.getWriter();
- res.setContentType("text/html");
- out.println(new Date().toString());
- out.println("<br>Server : "+context.getServerInfo());
- out.println("<br>Server Name : "+req.getServerName());
- out.println("<br>Server Port : "+req.getServerPort());
- out.println("<br>Server Protocol :"+req.getProtocol());
- }
- public String getServlet()
- {
- return "Click";
- }
- }
Add Comment
Please, Sign In to add comment