|
JTextPane with servlets
I am using a JTextPane as a browser for simple servlet testing using a simple webserver on localhost and HttOutputStream.
The textpane displays HTML ok except when returned by a servlet in which case I see the HTML markup. Connecting on an external browser like IE shows the servlet response correctly as HTML.
The problem only happens when the servlet is called by a simple form; it works ok if called by hyperlink or the servlet address (+params) is typed into the address bar.
Looking through the code that I wrote 5 years ago I see that i use a URLConnection to retrieve the data from the server from a hyperlink listener and then call setText() on the textpane. In the case of an HTML form, the server replies directly to the JTextPane which seems to forget it should display the returned text as HTML and not plain text. This worked before i migrated it to Java 1.6. There must be some tweek required, but what ?
Any ideas ?
Last edited by kinabaloo : 07-11-2008 at 08:35 AM.
Reason: adding detail
|