package jee5study.exercise.disboard.servlet;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
public class Board implements servlet {
private String SvName;
private Date Started;
public void init(ServletConfig config) {
SvName = config.getServletName();
Started = new Date( (java.lang.System.currentTimeMillis()));
System.out.println("Servlet: " + SvName);
System.out.println(" Started: " + Started.toString());
}
public void destroy() {
Date stopped = new Date( (java.lang.System.currentTimeMillis()));
System.out.println("Servlet: " + SvName);
System.out.println(" Destroyed: " + stopped.toString());
}
protected void processRequest(ServletRequest request, ServletResponse response) throws SevletException,IOException {
String user = request.getParameter("user");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<title>Board Title</title>");
out.println("</head>");
out.println("<h2>Board Title</h2><HR>");
if (user != null) {
out.println("<p>Hello " + user +"!");
}
out.println("<p>My name is " + SvName);
out.println("<p>I was started on " + Started.toString());
out.println("</body>");
out.println("</html>");
out.close();
/** Returns a short description of the servlet.
* @return
*/
public String getServletInfo() {
return "Board Template";
}
public ServletConfig getServletConfig() {
return getSevletConfig();
}
public void service(ServletRequest servletResponse, ServletResponse servletResponse) throws ServletException,IOException { processRequest(servletRequest,servletResponse);
}
Hey Guys, When i compile the above in J2EE building a servlet, i get an error saying that "Reached end of file while parsing" Please assist me on how to solve it.
Thanks