Attach an HTML Tag to the HEAD of an HTML Doc in Java

If you frequently work with HTML documents, ensuring you have all the critical components can become tedious and the margin for error increases. In this brief tutorial, we will demonstrate how you can use an API to automatically append an HTML tag to the HEAD of an HTML document in Java, avoiding the possibility of missing this important element.

To install with Maven, we will add a reference to the repository in pom.xml:


Then, we will add a reference to the dependency:


Now, we are ready to add the imports to the top of our controller and call the function with the following code:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.EditHtmlApi;

That’s it! Quick and simple.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.