Jersey, using HTML file instead of HTML string
06:54 02 Jun 2016

Currently I need to programm a RESTful Webservice in Java and I'm using Grizzly server as my server and I'm using Jersey for the HTML code generation.

This is my Grizzly server:

public static void main(String[] args) throws IOException {
    URI baseUri = URI.create("http://localhost:9998");
    final ResourceConfig resourceConfig = new ResourceConfig(homepage.class);
    final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);
    System.out.println("Starting grizzly ...");     
    JOptionPane.showMessageDialog(null, "Stop Server");
    server.shutdownNow();
}

And this is my current homepage code:

@Path("")
public class homepage {

@GET
@Produces("text/html")
public String sayHelloInHtml() {
    return "

Hello World

"; } }

Right now I'm using a string for my HTML code but is their a way to use a HTML file instead?

Also how can I create a button that triggers a Java method on click? I know how to create a button but I don't know how to make the event handler to trigger the Java method on click.

java html jersey