java - Can I remove unnecessary newlines/whitespace in my Spring Framework webapp response data? -
in response server gives client, noticing quite bit of whitespace , newlines. response body seems sending newline every line of parsed jsp. curious if problem has written bean for? need worry about?
example jsp:
<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <%@page import="java.util.date"%> <%@page import="java.util.gregoriancalendar"%> <%@page import="java.util.properties"%> <%@page import="java.util.map"%> <%@page import="java.util.hashmap"%> <%@page import="java.io.ioexception"%> <head> <title>my page!</title> <% string message = "hello world!"; %> </head> <body> <div><%=message%></div> </body> </html>
example html response:
<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <!-- these blank newlines ... --> <head> <title>my page!</title> </head> <body> <div>hello world!</div> </body> </html>
yes, can that. try:
<%@ page trimdirectivewhitespaces="true" %>
more details available here: strip whitespace jsp output
Comments
Post a Comment