LSP and Maverick

LSP pages can be used as a View technology in the Maverick MVC framework.

Add the following to your maverick.xml file:

<modules>
    <view-factory type="lsp" provider="nu.staldal.lsp.maverick.LSPViewFactory"/>
    <transform-factory type="xslt" provider="nu.staldal.lsp.maverick.XSLTransformFactory"/>        
</modules>

The compiled LSP pages should be placed in WEB-INF/classes.

Place lsprt.jar in the same place as maverick.jar (either both in in some shared CLASSPATH of your application server, or both in the WEB-INF/lib directory of each web application using LSP).

LSP view factory supports the default-bean-name, and LSP views the bean attribute to specify the name of the model. Default is "model". The model is passed as a top level variable to the LSP page, and can be accessed as a tuple in the LSP page.

Use XSLT if you want to transform the output of an LSP page. The LSP page will send its output directly to the XSLT processor using SAX events, with no need for XML parsing. If you install the custom XSLT transform factory as above, you can place the stylesheets in WEB-INF/classes (and not with the web content as Maverick use to have it).

Sample part of maverick.xml file:

<maverick version="2.0" default-view-type="lsp" default-transform-type="xslt">

  <modules>
    <view-factory type="lsp" provider="nu.staldal.lsp.maverick.LSPViewFactory"/>
    <transform-factory type="xslt" provider="nu.staldal.lsp.maverick.XSLTransformFactory"/>        
  </modules>

  <views>
    <view id="loginRequired" path="loginRequired.lsp">
      <transform path="trimOutside.xsl"/>
    </view>
  </views>

</maverick>

See the sample/friendbook-lsp directory for a complete example. This example is a port of the "friendbook" example in the Maverick distribution.