在 servlet 的 HTML 输出中设置背景颜色
我有这样的 Servlet 代码,
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hi</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>" + "OK" + "</h1>");
out.println("</body>");
out.println("</html>");
任何人都可以帮助我,我如何在输出 html 页面上定义背景颜色。
I have Servlet code like,
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hi</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>" + "OK" + "</h1>");
out.println("</body>");
out.println("</html>");
Can anybody help me, how can I define bacground color on the output html page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将 #d3d3d3 替换为您想要的颜色(颜色名称或十六进制颜色带有 #
replace #d3d3d3 with the color you want (either color name or hex color with #
例如
out.println("");
for example
out.println("<body bgcolor='#E6E6FA'>");
您可以在 body 标记上使用内联样式:
而不是
使用
或
You can use inline styling on the body tag:
Instead of
Use
or
您可以通过这种方式来更正 servlet 的信息
You can approach it this way to correct information to your servlet