Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing text from mysql to javascript on JSP page
    primarykey
    data
    text
    <p>I have a block of text I store in a mysql table as longtext and then I retrieve using struts bean:define for jsp. I want to retrieve this block of text for use in a jquery UI dialog which means the text must be parsed with the "\n" characters. Currently the text comes out like</p> <pre><code>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."; </code></pre> <p>I need the data to be in this format:</p> <pre><code>emailMSG[&lt;%=id%&gt;] = "%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."; </code></pre> <p>How can I get the "\n"+ characters in the data coming out of the mysql table?</p> <p>Here is the bit of my code that references this part (I removed the non relevant pieces):</p> <pre><code>&lt;logic:iterate id="cel" name="CourseEmailList" scope="request"&gt; &lt;bean:define id="msg" property="message" name="cel" scope="page" type="java.lang.String"/&gt; &lt;bean:define id="id" property="id" name="cel" scope="page" type="java.lang.String"/&gt; &lt;tr&gt; &lt;logic:notEmpty name="cel" property="message" scope="page"&gt; &lt;td&gt;&lt;a href="#" onclick="OpenDialog(&lt;bean:write name='cel' property='id' scope="page"/&gt;);return false;"&gt;View/Modify&lt;/a&gt; &lt;script type="text/javascript"&gt; courseIDs[&lt;%=id%&gt;] = "&lt;%= id%&gt;"; emailMSG[&lt;%=id%&gt;] = "&lt;%= msg%&gt;"; &lt;/script&gt; &lt;/td&gt; &lt;/logic:notEmpty&gt; &lt;/tr&gt; &lt;/logic:iterate&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload