MasterKey: JavaServer Faces

MKJSF is an open source library (mkjsf.jar) that you can include in your JavaServer Pages project to create a rich and responsive search interface on top of our high-performance meta-search engine Pazpar2.

To see an example of the concept in practice, check out the JSF demo site.

MKJSF exposes the Pazpar2 protocol of commands and responses in a straight forward way. In essence it is a JSF Expression Language API to Pazpar2, putting the power of Pazpar2 at the fingertips of the XHTML page author.

Pazpar2 commands are accessible through the object pzreq and responses through pzresp. Command parameters are set and read with expressions like #{pzreq.search.query} and #{pzreq.show.num}. The responses from Pazpar2 are rendered by, for example, iterating over pzresp.show.hits and then writing out data items like #{hit.title} and #{hit.author}. More documentation on available commands can be found in the Pazpar2 documentation and in Javadoc: Commands.

Included in the library is also an Ajax based mechanism for polling Pazpar2 for more results until the entire set of remote search targets has responded. This mechanism is activated in form of a tag that you would add to the XHTML page and simply list exactly what parts of the page you want updated on each poll.

Getting started

The quickest way to get started is by downloading the tutorial application - a complete J2EE web application ready to install in Tomcat 7 or a J2EE application server like Glassfish or JBoss. You’ll find the .war files on our ftp server. There’s a PDF describing the steps of building a search interface in a few dozen lines of code.

The sample application is pre-configured to access or hosted search service at /mkc.indexdata.com:9009/service-proxy/ so no configuration needed.

Putting it to work in your own context

Building the project

The Maven project containing the Tomcat 7 version of the library can be found in our Maven repository

In order to include the library from the Maven repository in your own Tomcat7 web application you would add the Index Data repository and the mkjsf dependency to your Maven POM (if you are using Maven of course):

<repository>
  <id>id-maven-repo</id>
  <url>http://maven.indexdata.com</url>
</repository>

and

<dependency>
   <groupId>com.indexdata</groupId>
   <artifactId>mkjsf</artifactId>
   <version>0.0.6</version>
</dependency>

If you are not using Maven you would probably have to resolve dependencies as they apply to either Tomcat 7 or JBoss/GlassFish. The Maven site for this project contains a list of those dependencies for the Tomcat 7 version.

Configuring a Pazpar2 Service

The library comes with two alternative configuration mechanisms.

See Javadoc: Configuring your service for more information about configuration options. It’s basically about selecting the Pazpar2 service URL and service type, which can even be done straight from XHTML code if you should prefer that approach. In the tutorial you will find sample configurations for both approaches.

Useful Links

Here are the links to binaries, documentation, tutorials etc.

Latest: 0.0.6
2013/06/27
Licence: GPL
 

Documentation