0
我有一塊文本存儲在mysql表格中作爲longtext,然後使用struts bean進行檢索:define for jsp。我想要檢索這個文本塊在jQuery UI對話框中使用,這意味着文本必須用「\ n」字符分析。目前文本出來像將文本從mysql傳遞到JSP頁面上的javascript
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.";
我怎樣才能獲得「\ n」 +數據中的字符出來mysql表的?
這裏是我的代碼位引用該部分(我刪除了不相關的碎片):
<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>