Results 1 to 3 of 3
Thread: JTextPane with servlets
- 07-11-2008, 12:05 AM #1
Member
- Join Date
- May 2008
- Posts
- 6
- Rep Power
- 0
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 06:35 AM. Reason: adding detail
- 07-11-2008, 02:00 AM #2
Member
- Join Date
- May 2008
- Posts
- 6
- Rep Power
- 0
Indeed, I found the contentType had been set to text/plain instaed of text/html
How to avoid this ?
- 07-11-2008, 06:32 AM #3
Member
- Join Date
- May 2008
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
JTextPane Styles Example
By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:48 PM -
[SOLVED] hyperlinks in JTextPane
By olbion in forum New To JavaReplies: 4Last Post: 05-05-2008, 03:28 AM -
how to show a html document on JTextPane
By mary in forum Advanced JavaReplies: 2Last Post: 08-02-2007, 01:40 PM -
how to insert tables into JTextPane
By osval in forum AWT / SwingReplies: 1Last Post: 07-29-2007, 09:11 AM -
Transparent JTextPane
By Ada in forum AWT / SwingReplies: 1Last Post: 05-31-2007, 09:50 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks