在会话中使用字符串在jsp页面中断行

时间:2012-08-09 18:33:45

标签: java html jsp jstl

我在servlet中有doPost -

protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {

        request.getSession().setAttribute("sysMsg","now we gonna to break line \n");

        // forward to printLine.jsp page 
            dispather.forward(request, response) ; 
    }

和jsp页面(说,printLine.jsp) -

<html>
<head>
<title></title>
</head>
<body>
    <font size="30" color="Red">${sysMsg} </font>
</body>
</html>

我想在printLine.jsp中打印sysMsg最后断行...为了将\n放在sysMsg的末尾,当他在servlet中设置时,但这种方式不起作用。

1 个答案:

答案 0 :(得分:4)

尝试使用<br/>

request.getSession().setAttribute("sysMsg","now we gonna to break line <br/>");