import [Link].
*;
import [Link].*;
import [Link].*;
public class Welcome extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
// Set content type for the response
[Link]("text/html");
// Get the writer to write the response
PrintWriter out = [Link]();
// Generate a simple HTML response
[Link]("<html><body>");
[Link]("<h1>Hello, Jakarta Servlet!</h1>");
[Link]("</body></html>");
}
}
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
public class DateTimeServlet extends HttpServlet {
// Override the doGet method to handle GET requests
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
// Set the response content type
[Link]("text/html");
// Get the PrintWriter object to write response data
PrintWriter out = [Link]();
// Get the current date and time
Date currentDate = new Date();
// Generate HTML response with current date and time
[Link]("<html>");
[Link]("<head><title>Current Date and
Time</title></head>");
[Link]("<body>");
[Link]("<h2>Current Date and Time of
Server:</h2>");
[Link]("<p>" + [Link]() + "</p>");
[Link]("</body>");
[Link]("</html>");
// Close the PrintWriter
[Link]();
}
}