1) In your servlet code, you are doing it wrong. You must either output using PrintWriter println() or use the RequestDispatcher forward() method. But NOT like in the same servlet method .
Quote: What is a query manager and how to use it?
Unlike the case with 'include', 'forward' discards the previous output that the servlet wrote back .
See examples on the above page.
And if you decide to use forward() to transfer data previously received from your database, you can save this data in the request area, i.e. set request attributes e.g.
request.setAttribute("actionTime", action_time);
Of course, you must do this before calling forward() !
Then in your JSP you can display this data using Expression Languge , for example:
test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <title>Test Page</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <h1>Testing the passed values</h1> <p>Action time: ${actionTime}</p> </body> </html>
2) Another problem in your servlet code is a line that has the following:
((ResultSet) request).getString("action_time")
Neaither ServletRequest and HttpServletRequest has a getString() method. Although the ResultSet has such a method, it is pointless and not in your case to send a request to the ResultSet.
PS
Using scripts in JSP is not recommended
source share