Results 1 to 6 of 6

Thread: Zimlet JSP using Zimbra's API

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Default Zimlet JSP using Zimbra's API

    I use Zimbra Desktop, I create the dir _dev (ZimletWritingTip - Zimbra :: Wiki) and I can try my zimlet: everything is working.

    But now I want to use JSP (using java libraries to access to mysql db); also through the JSP pages, is possible to access to the Zimbra fields.

    Does anyone know how to invoke a JSP page as zimlet in Zimbra Desktop and how to instruct in the jsp page so I can read the Zimbra fields (specifcally who is logged at that time)?

    Thanks

  2. #2
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    OLD: ZimletJSP - Zimbra :: Wiki
    NEW: Zimlet JSP - Zimbra :: Wiki

    this zimlet used JSP for stuff..you can read the JSP file to get the idea
    Get or contribute Zimlets, UI themes, and languages in the Zimbra Gallery - Alfresco


    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  3. #3
    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Default

    Quote Originally Posted by raj View Post
    Thanks 4 the reply.

    I've been able to execute a JSP:

    a create a symbolic link from /home/<userdir>/public_html/zimbra to /home/<userdir>/zimbra
    then a create in the _dev the dir org_munet_prova conteinig the files ciao.jsp newVideo.jsp org_munet_prova.xml zimlet.js

    In details
    org_munet_prova.xml:
    Code:
    <zimlet name="org_munet_prova" version="1.0" description="JSP_Zimlet">
    
    <include>zimlet.js</include>
    <handlerObject>Org_munet_prova</handlerObject>
    
    <zimletPanelItem label="Prova JSP Zimlet" icon="My-panelIcon">
       <toolTipText>This is a super awesome zimlet that does something.</toolTipText>
       <contextMenu>
           <menuItem label="JSP Zimlet" id="JSPZimlet" icon="My-panelIcon">
               <canvas type="window" title="prova" width="700" height="500" />
               <actionUrl target="http://localhost/~mune" />
           </menuItem>
       </contextMenu>
     </zimletPanelItem>
    </zimlet>
    zimlet.js
    Code:
    function Org_munet_prova() {
    }
    
    Org_munet_prova.prototype = new ZmZimletBase();
    Org_munet_prova.prototype.constructor = Org_munet_prova;
    
    Org_munet_prova.init = function() {
    };
    
    // Called by the Zimbra framework when the panel item was double clicked
    Org_munet_prova.prototype.doubleClicked = function() {
            this.singleClicked();
    };
    
    // Called by the Zimbra framework when the panel item was clicked
    Org_munet_prova.prototype.singleClicked = function() {
            var url = this.getResource("ciao.jsp");
            window.oppwin = window.open(url," oppwin", "menubar=no,width=0.1px,height=0.1px");
    };
    and finally ciao.jsp which merely prints "hello world"
    Code:
    <!-- prova.jsp -->
    <html>
    <body>
      JSP -> <% out.println("Ciao Mondo!"); %>
    </body>
    </html>
    BUT

    if ciao.jsp uses the directive taglib
    Code:
    <!-- prova.jsp -->
    <%@ taglib uri="/WEB-INF/zimbra.tld" prefix="z" %>
    <html>
    <body>
      JSP -> <% out.println("Ciao Mondo!"); %>
    </body>
    </html>
    when the browser opens the JSP page i get
    Code:
    HTTP ERROR: 500
    
    INTERNAL_SERVER_ERROR
    
    RequestURI=/service/zimlet/_dev/org_munet_prova/ciao.jsp
    Caused by:
    
    java.lang.NullPointerException
    	at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:234)
    	at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:482)
    	at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:562)
    	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1626)
    	at org.apache.jasper.compiler.Parser.parse(Parser.java:165)
    	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:223)
    	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:124)
    	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
    	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:398)
    	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:477)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:371)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    	at com.zimbra.cs.zimlet.ZimletFilter.doFilter(ZimletFilter.java:204)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:716)
    	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:406)
    	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
    	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    	at org.mortbay.jetty.handler.RewriteHandler.handle(RewriteHandler.java:176)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    	at org.mortbay.jetty.Server.handle(Server.java:313)
    	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
    The problem is half solved

  4. #4
    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Default

    Quote Originally Posted by mune72 View Post
    [...]
    Code:
    <!-- prova.jsp -->
    <%@ taglib uri="/WEB-INF/zimbra.tld" prefix="z" %>
    <html>
    <body>
      JSP -> <% out.println("Ciao Mondo!"); %>
    </body>
    </html>
    [...]
    Anyone can tell me how to handle the Zimbra taglibrary?

    Thanks

  5. #5
    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Default

    Quote Originally Posted by mune72 View Post
    Anyone can tell me how to handle the Zimbra taglibrary?

    Thanks
    I give the answer to myself

    Using the taglibrary is possible only on the server version of zimbra which has tomcat, and not on desktop one.

    In the wiki page is said
    Code:
    tld is found at /opt/zimbra/tomcat/webapps/service/WEB-INF/zimbra.tld with the local URL of /WEB-INF/zimbra.tld.
    
     <%@ taglib uri="/WEB-INF/zimbra.tld" prefix="z" %>
    but in the desktop version...
    Code:
    find zimbra/ -name WEB* -print
    zimbra/zdesktop/jetty/webapps/service/WEB-INF
    zimbra/zdesktop/jetty/webapps/zimbra/WEB-INF
    there isn't any .tld file
    Code:
    ls zimbra/zdesktop/jetty/webapps/service/WEB-INF
    classes  lib  web.xml
    So it has a bunch of reasons for complaing.

  6. #6
    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Default

    Still trying to access to zimbra's variables...

    The framework was .xml -> .js -> .jsp

    I read this page Zimlet JavaScript Class - Zimbra :: Wiki

    So I modified my .js in this way
    Code:
    function Org_munet_prova() {
    }
    
    Org_munet_prova.prototype = new ZmZimletBase();
    Org_munet_prova.prototype.constructor = Org_munet_prova;
    
    Org_munet_prova.init = function() {
    };
    
    // Called by the Zimbra framework when the panel item was double clicked
    Org_munet_prova.prototype.doubleClicked = function() {
    	this.singleClicked();
    };
    
    // Called by the Zimbra framework when the panel item was clicked
    Org_munet_prova.prototype.singleClicked = function() {
    	// this.getUserProperty(“PropertyName”)
    	var variabile = this.getUserPropertyInfo("websiteUrl")["value"];
    
    	var url = this.getResource("ciao.jsp");
    	window.oppwin = window.open(url, "oppwin", "menubar=no,width=0.1px,height=0.1px");
    };
    but with the line
    Code:
    var variabile = this.getUserPropertyInfo("websiteUrl")["value"];
    doesn't work while commenting it out
    Code:
    //var variabile = this.getUserPropertyInfo("websiteUrl")["value"];
    works.

    Anybody can help? Thanks

Similar Threads

  1. Replies: 6
    Last Post: 03-05-2010, 12:13 AM
  2. Replies: 21
    Last Post: 02-04-2010, 09:06 AM
  3. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 07:38 AM
  4. Replies: 5
    Last Post: 01-11-2008, 04:34 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •