Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jelly Script

shivaraj ck
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2011

Hi all, I am new to jelly Script. I am using jelly Script to display tables stored in the databse, I am able to dispalay column wise, but i want to diaplay table rowwise. I used separate xml file"(which contains jelly script) and Java bean(where script file is called and op is passed to an html file) for this. The table has six columns. I want to display row by row data. I have used embedded jelly concept form the link: http://commons.apache.org/jelly/tutorial.html

Please help me with this.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
shivaraj ck
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 23, 2011

Hi Nic Brough, thanks for replaying. Here is the code i am using. I am using eclipse to run the code.

package jellypackage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.XMLOutput;
import java.sql.*;
import java.util.Vector;
public class Jelly {
public static void main(String[] args) throws Exception
{
Connection conn;
Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection("jdbc:postgresql://172.20.178.243:5432/TREX 2.1","postgres","postgres");
System.out.println("\t!!!!!!!!!!!!DATABASE CONNECTION ESTABLISHED!!!!!!!!!!!!!\n\n");

ResultSet rs= null;
Statement s = null;
String i = null;
String j=null;



s=conn.createStatement();
rs=s.executeQuery("SELECT * FROM res_task_workspace");

String template = "C:\\Documents and Settings\\396056\\jelly1.xml";
OutputStream output = new FileOutputStream("C:\\Documents and Settings\\396056\\results.html"); // file to which o/p of script written
JellyContext jcontext = new JellyContext();
jcontext.setVariable("name","396056");
jcontext.setVariable("background","pink");
jcontext.setVariable("url","C:\\Documents and Settings\\396056\\My Documents\\My Pictures\\vista.jpeg");
Vector<String> v = new Vector<String>();
Vector<String> u = new Vector<String>();
int k=0;

while ( rs.next() )
{
i = rs.getString("id");
j= rs.getString("ResourceName/TaskName");
v.add(i);
u.add(j);

}

jcontext.setVariable("ids", v);
jcontext.setVariable("ResourceName", u);


XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
// jcontext.run
jcontext.runScript(new File(template), xmlOutput); // run jely script and place o/p in output file
xmlOutput.flush();

}



}

jelly Script...

<?xml version="1.0"?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html">
<html>
<head>
<title>${name}'s Page</title>
</head>
<body bgcolor="${background}">
text="#FFFFFF">
<h1>${name}'s Homepage</h1>
<img src="${url}"/>
<h2>My Hobbies</h2>
<ul>
<j:forEach var = "i" items= "${ids}">
<li>Name : ${dsi} </li>
</j:forEach>
</ul>
</body>
</html>
</j:jelly>

here i have included 2 columns from the table,

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2011

Does this actually relate to jira? Or are you just following a jelly tutorial? There doesn't seem to be any interaction with jira at all here.

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2011

You're going to have to go into more detail on this one - most of us use Jelly to do things, not display data. Could you post your Jelly script to begin with?

TAGS
AUG Leaders

Atlassian Community Events