HTML Area not showing contents properly

Hi All,

I have a problem with HTML area fields in my forms. We have a form that contains a HTML area to show the emails sent/recived to/from our application. emails are all HTML formatted. There is no issue with the emails with simple HTML formats. The problem is when there is any XML tags within HTML body in emails. In this situation, the content looks weird and not readable. It seems like the HTML area field can not read xml tagts properly. Is there any way that I can fix this issue? or do I need to make any changes in the HTML content to be able to show the content properly?

P.s when we use Servoy HTML editor bean, the contents show properly.

Is there anyway that I can make it work with HTML area field?

I have attached a sample of how the content looks like when there is any xml tags presented. and here is how the code look like:

"<HTMl><P><B><FONT color=#662278 face=Calibri><SPAN style="FONT-FAMILY: Calibri; COLOR: #662278; FONT-SIZE: 12pt; FONT-WEIGHT: bold" lang=EN-US><?xml:namespace prefix = o /><o:p><FONT color=navy face="Times New Roman"><SPAN style="COLOR: navy; FONT-SIZE: 12pt"></SPAN></FONT></o:p></SPAN></FONT></B></P>
<P><FONT color=#0d0d0d></FONT></P>
<P><FONT color=#0d0d0d><IMG border=0 alt="" src="http://www.theservicemanager.com/images/newsletter/tsmlogo2.jpg" width=693 height=130> </FONT></P><FONT color=#0d0d0d>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT color=#000000><FONT face=Calibri>Hi Michael,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT color=#000000><FONT face=Calibri>The table file showing a ‘too large’ error is likely due to corruption. Please follow the attached document to run a check on your TSM database.<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT color=#000000><FONT face=Calibri>If this does not resolve the problem, please let us know and we can organise to remote in and assist further.<o:p></o:p></FONT></FONT></SPAN></P>
<P></FONT><SPAN style="COLOR: #0d0d0d"><STRONG><?XML:NAMESPACE PREFIX = U1 /><U1:PERSONNAME w:st="on"><FONT color=#000000 face=Calibri><SPAN style="COLOR: black; FONT-SIZE: 12pt" lang=EN-US><STRONG><U1:PERSONNAME w:st="on"><FONT color=#000000 face=Calibri><SPAN style="COLOR: black; FONT-SIZE: 12pt" lang=EN-US><STRONG>Regards, 
Scott Hannett 
Support Manager
</STRONG></SPAN></FONT></U1:PERSONNAME><SPAN style="COLOR: black; FONT-WEIGHT: bold" lang=EN-US><FONT color=#000000 face=Calibri>The Service Manager – TSM 
</FONT></SPAN><U1:ADDRESS w:st="on"><U1:STREET w:st="on"><?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:address w:st="on"><st1:Street w:st="on"><FONT color=#000000 face=Calibri><SPAN style="COLOR: black; FONT-SIZE: 12pt" lang=EN-US><STRONG>Level 2, 62 Wyndham Street
Alexandria NSW 2015<SPAN style="COLOR: #0d0d0d"><STRONG><U1:PERSONNAME w:st="on"><FONT color=#000000 face=Calibri><SPAN style="COLOR: black; FONT-SIZE: 12pt" lang=EN-US><STRONG><U1:ADDRESS w:st="on"><SPAN style="COLOR: black" lang=EN-US><U1:STREET w:st="on"><U1:ADDRESS w:st="on"><st1:Street w:st="on"><st1:address w:st="on"><STRONG><FONT color=#000000 face=Calibri>
</FONT></STRONG></U1:ADDRESS></U1:STREET></st1:address></st1:Street></SPAN></U1:ADDRESS></STRONG></SPAN></FONT></U1:PERSONNAME></STRONG></SPAN></STRONG></SPAN></FONT></st1:Street></st1:address></U1:STREET><SPAN style="COLOR: black; FONT-WEIGHT: bold" lang=EN-US><FONT color=#000000 face=Calibri>Tel 61 2 9690 3888 
</FONT></SPAN></U1:ADDRESS><U1:ADDRESS w:st="on"><FONT color=#000000><FONT face=Calibri><SPAN style="COLOR: black; FONT-WEIGHT: bold" lang=EN-US>Fax  61 2 9690 3800 
</SPAN><SPAN style="COLOR: #3366ff; FONT-SIZE: 14pt" lang=EN-US><A title=blocked::http://www.theservicemanager.com/ href="http://www.theservicemanager.com/"><FONT title=blocked::http://www.theservicemanager.com/><SPAN title=blocked::http://www.theservicemanager.com/><SPAN style="COLOR: black; FONT-SIZE: 12pt"><STRONG>www.theservicemanager.com</STRONG> </SPAN></SPAN></FONT></A></SPAN><SPAN style="COLOR: #3366ff; FONT-SIZE: 14pt"><o:p></o:p></SPAN>

</FONT></FONT></U1:ADDRESS></P>
<P class=MsoNormal></STRONG></SPAN></FONT></U1:PERSONNAME></STRONG></SPAN><U1:ADDRESS w:st="on"><U1:ADDRESS w:st="on"><FONT color=#000000><FONT size=1><FONT face=Arial>This e-mail message and any attachments contain information that is confidential and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, pass on or copy this message or any attachments. If you have received this e-mail in error, please notify us by return e-mail and erase all copies of this message including any attachments. Thank you.  </FONT></FONT></FONT></U1:ADDRESS></U1:ADDRESS></P></HTML>"

You inputs are much appreciated.

Cheers,
Siavash

This looks like a HTMLArea in the Smart Client to me. Unfortunately, the HTML support in the plain HTML Area field in the Smart Client, which directly derived for Java Swing’s HTML rendering support, is not that great.

You have 2 options:
1- try preprocessing the HTML into something that will be represented correctly in the plain HTMLArea
2- Replace the plain HTMLArea with something else, for example the svyJFXWebView module

I think the latter will be a lot less work.

Paul

Hi Siavash,

Servoy’s HTML_AREA uses the Java built-in HTML renderer which is very old. Even though it’s part of the JVM it hasn’t been updated much and only supports HTML3, a subset of HTML4 and CSS2. So to make HTML emails show properly you have a couple of options:

  1. parse out all the XML type code out of the HTML before showing it in the HTML_AREA
  2. use a third party bean like Patrick Talbot’s BrowserSuite or the commercial Sferyx
  3. use JavaFX to show the HTML

Downside of option 2 is that the BrowserSuite stopped working under Java 7 on Mac so you loose that deployment target. And Sferyx is a (very) good option but does cost you about 600-1200 USD depending on the version you get. Though the license is a developer license, not per seat.
Option 3 is a Java 7 only option, JavaFX is not standard in Java 6 and I am not sure how well JavaFX works in the current versions on Mac.
So the safe option would be option 1.

Hope this helps.

Thanks for your responses guys. Yes, the example is from a htmlarea running in smartclinet. I think I’m going to use the bean whenever the emailbody has any xml tags. so I’ll leave my tabpanel with a htmlarea to show the contents by default and I check the content before I display them and if there was a need for the bean, I’ll put the bean on the tabpanel on runtime, this way I don’t have to play with the html content (most of the email contents we have don’t have XML tags included and we are already using the bean for creating editing html email anyway). As you mentioned, the only problem is when the client is running on a mac machine under java 7 (Hopefully the problem with mac OS java 7 will be solved soon too :) ). I might have to work on parsing the content if there was a high number of our users using Mac java 7 configuration, but as of now, I think we can go with it this way :)

Cheers,
Siavash

Hi Siavash,

Actually if you have the BrowserSuite installed on the server (even if you don’t use it in your solution) and a Mac user using Java 7 wants to open the Smart Client it will hang.
In other words waiting until you have high number of Mac users using Java 7 might not be a good option.

??? I suppose it might be because of the flags that the BrowserSuite is adding to servoy.vmargs, but other than that, the jars are signed and should allow a smart client to run.

Hi Patrick,

I tried it with and without the flags and the client will simply not continue to load when you use Java 7 on the Mac.

Ah! Told you to ditch that Mac a long time ago! Johan will know what to do with it! ;-)

Seems you are right Robert, our smartclient doesn’t work on mac machines with the browsersuit installed on the server and it’s not really desirable. We have actually got our webclient working as well, so people on mac still can use our app (although there are some shortcomings with the servoy webclient, but usable for now).

ptalbot:
Ah! Told you to ditch that Mac a long time ago! Johan will know what to do with it! ;-)

The plugin is a really powerful plugin and we use it in a couple of modules in our application. We really don’t want to have this limitation for our mac users (either using webclient or java version earlier than java 7). Is there anyway you might be able to solve the issue with Mac OS Machines on java version 7, Patrick?

Cheers,
Siavash

Unfortunately I have no clue what is going on again with Mac OS and Java 7.

All I know is that the BrowserSuite is based on native components and special threading that Mac OS is barely supporting from the start and that I have already jumps so much hoops to make it work until now. Seriously 3/4 or my development time on this thing has been to workaround some Mac OS quirks… (Which is why I advise people to stay away from such a platform).
They keep adding bugs/incompatibilities to either Mac or the JDK on OS X, and I’m alone maintaining this thing. So don’t hold your breath.

I would advise looking at the JavaFX implementation of the browser (JWebPane) that Servoy has bundled in a bean and module of their new BAP platform…
Of course this will not work on Java 6 without JavaFX, but you could deal with it with profiles and use one or the other depending on the Java version.

Hi Siavash,

We had the same case as you (show emails in our application), we are using svyJFXWebView and it works great now.
It works very reliable on MAC with Java 7.

Mina

mnaeimi:
Hi Siavash,

We had the same case as you (show emails in our application), we are using svyJFXWebView and it works great now.
It works very reliable on MAC with Java 7.

Mina

Hi Mina,

I was wondering if svyJFXWebView works for editing email contents (generally HTML contents) as well? As we mainly use patrick’s plugin for its HTML editor. Another thing is, can you confirm if svyJFXWebView works with webclient too? We are looking for an option to work on both smart and webclients (webclient incompatibility is a big problem with most of the plugins we use).

Thanks,
Siavash

svyJFXWebView is a viewer component based on JavaFx which works only on desktop applications, so it only works on Smart client and not possibility to edit the content.
We are using two different code for webclient and smartclient. svyJFXWebView for smartclient and HTML_Area for webclient.