1,js替换

var text= $(this).text();
var reg = new RegExp("\\n","g");//g,表示全部替换。
text=text.replace(reg,"<br/>");

2,jstl替换

<%request.setAttribute("x_n", "\n");%>
${fn:replace(row, x_n, '<br/>')}

附:c:set直接替换会失败

<c:set var="str" value="${fn:replace(row,'\n', '<br/>')}" />
${str}

 

相关文章:

  • 2021-12-05
  • 2021-10-12
  • 2021-12-17
  • 2021-09-10
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2022-01-12
相关资源
相似解决方案