4.3.5. JSP integration

If you add JSP pages to the Docmenta web application, you will most likely need access to the Plug-in API from within your JSP page. For this a static method org.docma.plugin.web.WebPluginUtil.getUserSession() exists, which requires a javax.servlet.ServletContext instance and the user's session ID as parameters. Following listing shows a minimal JSP page that just outputs the user's login name:
<%@page contentType="text/html" pageEncoding="UTF-8" session="true"
// Note: application is an implicit JSP object (ServletContext)
String sessId = request.getParameter("docsess");
WebUserSession sess =
WebPluginUtil.getUserSession(application, sessId);
Your login name: <%= sess.getUser().getLoginId() %>

Listing 4.3.21. Minimal JSP integration example

Note that the JSP page has to be called with the URL parameter named "docsess", which has to be set to the session ID as returned by the org.docma.plugin.web.WebUserSession.getSessionId() method. For an example on opening a JSP page in a new browser window, see Section, “Plain JavaScript Dialogs”.