Skip to content
Advertisement

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

How to make javax Transformer output HTML (no self-closing tags)?

I’m using a javax.xml.transform.Transformer to convert an XML file into an HTML file. It can happen that a div will have no content, which causes the Transformer to output <div/>, which breaks rendering. I’ve searched and found that “You can change the xslt output to html instead of xml to avoid the problem with self closing tags”, but that was

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 thing yesterday. Note

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 &amp; 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 dead simple with Jsoup. Jsoup

Advertisement