Search code examples
javascriptstruts2tinymcewysiwyg

Tinymce not displaying html correctly?


i have below content coming from server which i am showing under textarea attached with tinymce

<p>Test1</p>
<p>Test2</p>

i see in browser with below p tags

<p>Test1</p> <p>Test2</p>

Thougs it should show as

Test1

Test2

I am not sure what i am missing here? I dont see any error in firebug console.When i inspect my textarea from firebug, it textarea is attached correctly with tinymce but somehow not displaying html content in right format? I am using struts 2 textArea i.e

Here is my tinymce configuration:-

function attachTinyMCE() {
         tinyMCE.init({
         mode: "textareas",
         theme: "advanced",
         plugins: "preview",
         readonly: true,
         theme_advanced_buttons1: "forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,|,formatselect,fontselect,fontsizeselect,sub,sup,|,bold,italic,underline,strikethrough",
         theme_advanced_buttons2: "",
         theme_advanced_toolbar_location: "top",
         theme_advanced_toolbar_align: "left",
         theme_advanced_statusbar_location: "bottom",
         theme_advanced_path: false,
         theme_advanced_resizing: true,
         entity_encoding: "raw"
      });
     }

UPDATE:- If i send the below content from server i.e

 <p>Test1</p>

 <p>Test2</p>

instead of

&lt;p&gt;Test1&lt;/p&gt;
&lt;p&gt;Test2&lt;/p&gt;

It is shown correctly in tinymce i,e

Test1

Test2

Solution

  • I got the issue. It was actually struts 2 tag that do the html escape.