2012-08-09 58 views
0

字符串我有doPost在servlet -断线通过使用会话

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中,但是这种方式并没有工作。

回答

4

尝试<br/>代替

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