4.3.3.1. Plain JavaScript Dialogs

For the first solution, the class WebUserSession provides a method named evalJavaScript. This method allows to send JavaScript code to the client. For example, assuming that the variable sess contains an instance of WebUserSession, following code can be used to open a custom dialog:
String sessId = sess.getSessionId();
String js = "window.open('plugins/my_plugin/my_dialog.jsp?docsess=" +
            sessId + "', '_blank','width=640,height=500,resizable=yes," +
            "scrollbars=yes,location=no,menubar=no,status=no');";
sess.evalJavaScript(js);
The code opens the JSP page named my_dialog.jsp in a new browser window (this assumes that the JSP page is included in the plug-in package). Note that the session ID is passed as URL parameter named docsess. This is required in case the Plug-in API needs to be accessed from within the JSP page. More information on how to access the Docmenta Plug-in API from a JSP page can be found in Section 4.3.5, “JSP integration”.