Skip to content

Tag: html

How to abbreviate HTML with Java?

A user enters text as HTML in a form, for example: I want to be able to output only a part of the string ( for example the first 20 characters ) without breaking the HTML structure of the user’s input. In this case: which renders as Is there a Java library able to do this, or a simple method

Automatically generate HTML pages in Java

I am developing a Java desktop application. I have a need to create HTML pages through my application. When the user clicks on View in Browser button a HTML page should be created with some details and shown it to the user. Is there a way I can do this? Is there are any resources I can use in this

Returning ZipOutputStream to browser

I have an ZipOutputStream that I want to return to the browser. The experience I would like is that the user clicks an anchor tag, and then a file download prompt is displayed for the ZipOutputStream that I have. How do you get the ZipOutputStream back to the browser? Answer Just had to do this exact same thi…

Remove HTML tags from a String

Is there a good way to remove HTML from a Java string? A simple regex like will work, but some things like & won’t be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the .*? in the regex will disappear). Answer Use a HTML parser instead of regex. This is dea…