Forums de discussion

message boards message display

sri p, modifié il y a 10 années.

message boards message display

Junior Member Publications: 85 Date d'inscription: 22/01/11 Publications récentes
Hello All,

I am using portal service util classes to create category and messages in liferay.
The message body is saving as follows in liferay database with quotes "<div><b>this is bold text</b><i>this text is in italics</i></div>" . (message format I set as: html ).
I am retrieving the content in custom action class and displaying it in a JSP page.

Now above message body text <div><b>this is bold text</b><i>this text is in italics</i></div>, coming as raw HTML code rather than rendering it as html.

Any help, please!

I am not sure, is there any liferay parser class that I need to use to render saved html text properly in JSP.

Thank you,
Sri
thumbnail
Zsigmond Rab, modifié il y a 10 années.

RE: message boards message display

Liferay Master Publications: 727 Date d'inscription: 05/01/10 Publications récentes
Hi Sri,

which version of the Liferay do you use?

Regards,
Zsigmond
sri p, modifié il y a 10 années.

RE: message boards message display

Junior Member Publications: 85 Date d'inscription: 22/01/11 Publications récentes
&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;


saving above empty html into mbMessage throwing following error (liferay 6.1.1 ee version)


ERROR [http-/127.0.0.1:8180-5][HtmlBBCodeTranslatorImpl:108] Unable to parse: <html>
20:13:33,894 INFO [stdout] (http-/127.0.0.1:8180-5) <head>
20:13:33,894 INFO [stdout] (http-/127.0.0.1:8180-5) </head>
20:13:33,895 INFO [stdout] (http-/127.0.0.1:8180-5) <body>
20:13:33,895 INFO [stdout] (http-/127.0.0.1:8180-5) </body>
20:13:33,895 INFO [stdout] (http-/127.0.0.1:8180-5) </html>

Parsing is failing due to "\n" characters in the HTML code. Failing In HtmlBBCodeTraslatorImpl.java at line 443 else if (data.matches("(?s).*\r?\n\\z")) {
bbCodeItem = bbCodeItems.get(marker.getValue() + 1);
...

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

20:13:33,756 INFO [stdout] (http-/127.0.0.1:8180-5) at java.util.ArrayList.RangeCheck(ArrayList.java:547)

20:13:33,756 INFO [stdout] (http-/127.0.0.1:8180-5) at java.util.ArrayList.get(ArrayList.java:322)

20:13:33,756 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.handleNewLine(HtmlBBCodeTranslatorImpl.java:443)

20:13:33,756 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.handleData(HtmlBBCodeTranslatorImpl.java:296)

20:13:33,757 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.parse(HtmlBBCodeTranslatorImpl.java:129)

20:13:33,757 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.getHTML(HtmlBBCodeTranslatorImpl.java:105)

20:13:33,757 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.parsers.bbcode.BBCodeTranslatorUtil.getHTML(BBCodeTranslatorUtil.java:51)

20:13:33,758 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.processContent(MBIndexer.java:357)

20:13:33,758 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.doGetDocument(MBIndexer.java:258)

20:13:33,758 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.search.BaseIndexer.getDocument(BaseIndexer.java:115)

20:13:33,759 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.doReindex(MBIndexer.java:314)

20:13:33,759 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.search.BaseIndexer.reindex(BaseIndexer.java:326)

20:13:33,759 INFO [stdout] (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.updateStatus(MBMessageLocalServiceImpl.java:1666)


Any ideas on this error or any help from liferay team?
I really appreciate any help!

Thank you and Regards,
Sri
sri p, modifié il y a 10 années.

RE: message boards message display

Junior Member Publications: 85 Date d'inscription: 22/01/11 Publications récentes
Answering my self :

Liferay htmlbcode parser is checking CR LF, "\r\n" but files thta I uploaded has "\n" so it is throwing parse error information.

Thanks,
Sri