I tried to make a simple Java Servlet app, that displays the date and time. The problem is: it won't show up when I load the page(the page itself does show up). I have debugged it, and the date and time does show up in the console.
TestServlet.java(not the whole file):
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date timeDate = new Date();
@SuppressWarnings("unused")
String time = format.format(timeDate);
request.getRequestDispatcher("/WEB-INF/test.jsp").forward(request, response);
}
test.jsp(whole file):
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Welcome! It is ${time}!</h1>
</body>
</html>
All help is welcome ;)