How can I import JTSL libraries in Confluence ?

 

3 answers

Why would you need it? You cannot use JSPs as your templates in Confluence. 

You can have a servlet defined, yes, but the templating engine is Velocity, not JSP.

Actually, my goal is to use the Confluence's instance web server functionality to call a user defines JSP which will be located http://Confluence Apps/admin/xxxxxx.jsp to access a table and to display the content on screen:

I have created the following:

 

<html> <head><title>Space/Page Statistics</title></head> <body> <%@ page import="java.util.*" %> <%@ page import="javax.sql.*;" %> <%

java.sql.Connection con; java.sql.Statement s; java.sql.ResultSet rs; java.sql.PreparedStatement pst;

con=null; s=null; pst=null; rs=null;

// Remember to change the next line with your own environment  String url=  "jdbc:mysql://mysql-wiki-1.test.internal/wiki";  String id= "";  String pass = "";

 try{

 Class.forName("com.mysql.jdbc.Driver");  con = java.sql.DriverManager.getConnection(url, id, pass);

 }catch(ClassNotFoundException cnfex){  cnfex.printStackTrace();

 }  String sql = "SELECT PageAccessedURL, COUNT(PageAccessedURL) `HitCount` FROM confluence_access_logs WHERE EntryDate >= '2015-01-06 18:46:50' AND EntryDate <= '2015-01-07 00:20:21' GROUP BY PageAccessedURL ORDER BY HitCount DESC limit 10  ";

 try{  s = con.createStatement();  rs = s.executeQuery(sql);  %> <table border="1"> <tr>  <th>Space/Page Name</th>  <th>Hit Count  </th> </tr>  <%  while( rs.next() ){  %><tr>  <td><%= rs.getString("PageAccessedURL") %></td>  <td><b><%= rs.getString("HitCount") %></b></td>  </tr>  <%  }  %>

 <%

 }

 catch(Exception e){e.printStackTrace();}  finally{  if(rs!=null) rs.close();  if(s!=null) s.close();  if(con!=null) con.close();  }

 %> </table>  </body>  </html>

 

I believe that developing this as a plugin would make more sense (as additionally to custom functionality you can develop yourself, there is a huge stack of Atlassian libraries you can access/use, and it is all initialized and ready to use, knows your user, context, etc). And for this particular case there are plugins already available: PocketQuery Developing some custom JSPs that just run within the Java Container... especially, the code you have pasted: no db connection pool, driver is initialized on request... not very efficient

Have use the plugin before ? Can't seem to configure using the Dynamic parameter as I need to request start and end date from user in the form of Month and year.

Have not used the plugin in real-world scenarios. So, developing a custom plugin for Confluence is a better option, than messing around with custom JSPs. https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/create-a-helloworld-plugin-project https://developer.atlassian.com/display/CONFDEV/Creating+a+New+Confluence+Macro We can take it offline, contact us via the contact form on http://www.confiforms.com/cfweb/ and I can try to help you to start with your custom plugin development

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

1,031 views 23 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you