2012-08-09 41 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/>");