我有一个文本块作为长文本存储在 mysql 表中,然后我使用 struts bean:define for jsp 检索。我想检索此文本块以在 jquery UI 对话框中使用,这意味着必须使用“\n”字符来解析文本。目前文字出来像
emailMSG[1] = "%fn %ln,
Our records indicate that certification in %gn, %cn, %sn expire(d) on %dt.
Please take the refresher course.
Please visit our portal to log into your training.
Please ignore any messages from CITI regarding course expiration. DO NOT log in directly to the CITI site.";
我需要数据采用这种格式:
emailMSG[<%=id%>] = "%fn %ln,\n"+
"\n" +
"Our records indicate that certification in %gn, %cn, %sn expire(d) on %dt.\n"+
"\n" +
"Please take the refresher course at the training site.\n"+
"\n" +
"Please visit our portal to log into the site.\n"+
"\n"+
"Please ignore any messages from CITI regarding course expiration. DO NOT log in directly to the CITI site.";
如何从 mysql 表中获取数据中的“\n”+ 字符?
这是我引用这部分的代码(我删除了不相关的部分):
<logic:iterate id="cel" name="CourseEmailList" scope="request">
<bean:define id="msg" property="message" name="cel" scope="page" type="java.lang.String"/>
<bean:define id="id" property="id" name="cel" scope="page" type="java.lang.String"/>
<tr>
<logic:notEmpty name="cel" property="message" scope="page">
<td><a href="#" onclick="OpenDialog(<bean:write name='cel' property='id' scope="page"/>);return false;">View/Modify</a>
<script type="text/javascript">
courseIDs[<%=id%>] = "<%= id%>";
emailMSG[<%=id%>] = "<%= msg%>";
</script>
</td>
</logic:notEmpty>
</tr>
</logic:iterate>