mysql テーブルに longtext として保存するテキスト ブロックがあり、jsp の struts bean:define を使用して取得します。このテキスト ブロックを取得して 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>