Skip to content




JAR services

API Explorer

examples package: Using Gloop to render a JSP

Gloop is brilliant at integration; and thanks to its seamless integration with Spring Web MVC, it is also capable of running full-blown web applications! Martini supports the creation and mapping of web pages the Spring way. But instead of Groovy code, did you know you can use Gloop to create your controller and populate your page with models1?

The examples package includes a sample service, API, and JSP page that shows how you can map and render a JSP page using Gloop.

Related articles

Please see the following articles for more information:

Try it!

To see the JSP page yourself: ensure that the examples package is started and then visit <host>/api/jspResponse/page2 or visit the examples package web examples at <host>/examples/web-examples.jsp2 on your browser.

The form returned by accessing the link

There, you will see the form above. Populate the form and submit it to see data get rendered. You will notice that upon submission, the data you entered will be visible above the form.

The page after submission

To see the files related to this example (and experiment with the results), expand the examples package in the Navigator and navigate to the code folder, then expand the jspResponse package. This package contains the .api file that defines the controller and the Gloop service responsible for mapping the values shown in the view.

├── ...
├── code
│   ├── ...
│   ├── jspResponse
│   │   ├── api
│   │   │   └── JspController.api
│   │   └── SendJspPage.gloop
│   ├── ...
├── ...

In addition to this, the JSP page, named sample.jsp, is visible in the example package's web directory.


To serve web content via Spring and Gloop, here are the steps you should follow:

  1. Put your JSP file under your package's web directory.
  2. Create a Gloop service with an output variable named $gloopView.
  3. Set the $gloopView variable's value so that it is equal to the basename3 (extension-excluded filename) of the JSP file.

  1. See MVC pattern

  2. <host> must be substituted with the base URL of your Martini instance. This URL will depend on the where your instance is hosted and how you've configured your server. 

  3. Although in general, what you should return also depends on the requirements of the configured ViewResolver