O'Reilly logo

GateIn Cookbook by Piergiorgio Lucidi, Luca Stancapiano, Ken Finnigan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating views

In the previous example, the portlet doesn't have a view, so if you install it, you will see nothing in the page of the portal. In this recipe, you will see the complete configuration and creation of the views for the portlet.

Getting ready

Add a new view for the portlet using Groovy, WebUI's preferred scripting tool. With Groovy, it is very simple to handle the WebUI components. Therefore, we need to add a new component to handle it in the view.

How to do it...

Carry out the following steps:

  1. Create a file MyPortlet.gtmpl inside the path MyApplication.war/groovy/MyApplication/webui/component:
    <%
    
      def rcontext = _ctx.getRequestContext() ;
    %>
    <div id="$uicomponent.id" class="MyPortlet">
       Started!!!
    </div>
  2. Add the Groovy template in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required