Piranha - a cloud container, an exciting, new and in progress project

This project is maintained by piranhacloud

Using JSP pages with Piranha Nano

Below is a quick recipe to get Piranha Nano serving JSP pages.

JSP page

<%@page contentType="text/html" pageEncoding="UTF-8" session="false"%>
Hello JSP

Java code

NanoPiranha piranha = new NanoPiranhaBuilder()
    .servlet("JSP Servlet", new JspServlet())
    .servletInitParam("JSP Servlet", "classpath", System.getProperty("java.class.path"))
    .servletInitParam("JSP Servlet", "compilerSourceVM", "1.8")
    .servletInitParam("JSP Servlet", "compilerTargetVM", "1.8")

NanoRequest request = new NanoRequestBuilder()

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
NanoResponse response = new NanoResponseBuilder()

piranha.service(request, response);

Note in this example src/test/jsp is the directory on your fileystem where you put the index.jsp page

Maven coordinates

Please use the following dependencies for the example


where y is the year, m is the month and p is the patch version of the release you want to use.