JSP server response
Translation results:
The Response object mainly transmits the results processed by the JSP container back to the client. You can set the HTTP status and send data to the client through the response variable, such as cookies, HTTP file header information, etc.
JSP server responsesyntax
The status line contains HTTP version information, such as HTTP/1.1, a status code, such as 200, and a very short message corresponding to the status code, such as OK.
JSP server responseexample
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ page import="java.io.*,java.util.*" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"><title>php.cn</title> </head> <body> <h2>Automatically refresh instance</h2> <% //Set to automatically refresh every 5 seconds response.setIntHeader("Refresh", 5); // Get the current time Calendar calendar = new GregorianCalendar(); String am_pm; int hour = calendar.get(Calendar.HOUR); int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); if(calendar.get(Calendar.AM_PM) == 0) am_pm = "AM"; else am_pm = "PM"; String CT = hour+":"+ minute +":"+ second +" "+ am_pm; out.println("Current time: " + CT + "\n");%></body></html>