Display DB Content - ATG

In ORACLE (CORE SCHEMA)
SQL> create table blog_registration(id NUMBER(5) PRIMARY KEY, username VARCHAR2(40), email VARCHAR2(30), password VARCHAR2(40));


SQL> insert into blog_registration values(1,'Muthu pandian','base.muthupandian@gmail.com','12345');


/ATG/ITSStore/j2ee-apps/ITS/its.war/blog/repoTest.jsp


<dsp:page>    
<dsp:droplet name="/its/blog/DisplayBlogDroplet">
<dsp:oparam name="ousername">
<dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="items" />
<dsp:oparam name="output">
           FullName :  <dsp:valueof param="element.username"></dsp:valueof><br>
</dsp:oparam>
</dsp:droplet>
</dsp:oparam>
</dsp:droplet>
</dsp:page>


/ITS/config/its/blog/DisplayBlogDroplet.properties


$class=com.its.blog.droplet.DisplayBlogDroplet
$scope=global
blogRepository=/its/blog/BlogRepository
userRepository=/atg/userprofiling/ProfileAdapterRepository


/ITS/src/com/its/blog/droplet/DisplayBlogDroplet.java


package com.its.blog.droplet;


import java.io.IOException;
import java.util.Set;


import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;


import atg.repository.MutableRepository;
import atg.repository.Repository;
import atg.repository.RepositoryException;
import atg.repository.RepositoryItem;
import atg.repository.RepositoryItemDescriptor;
import atg.repository.RepositoryView;
import atg.repository.rql.RqlStatement;
import atg.servlet.DynamoHttpServletRequest;
import atg.servlet.DynamoHttpServletResponse;
import atg.servlet.DynamoServlet;
import atg.servlet.ServletUtil;


public class DisplayBlogDroplet extends DynamoServlet{


private Repository blogRepository;
private Repository userRepository;
@Override
public void service(DynamoHttpServletRequest req,
DynamoHttpServletResponse res) throws ServletException, IOException{


try {
RepositoryView view = getBlogRepository().getView("registration");
RqlStatement statement = RqlStatement.parseRqlStatement("ALL");
RepositoryItem[] items = statement.executeQuery(view,null);
if(items==null){
System.out.println("Is Null");
}
else{
req.setParameter("items", items);
}
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
req.serviceLocalParameter("ousername", req, res);


}


public Repository getBlogRepository() {
return blogRepository;
}


public void setBlogRepository(Repository blogRepository) {
this.blogRepository = blogRepository;
}
/**
* @return the userRepository
*/
public Repository getUserRepository() {
return userRepository;
}


/**
* @param userRepository the userRepository to set
*/
public void setUserRepository(Repository userRepository) {
this.userRepository = userRepository;
}
}


/ITS/config/its/blog/BlogRepository.xml


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gsa-template
      PUBLIC "-//Art Technology Group, Inc.//DTD Dynamo Security//EN"
      "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">
      
<gsa-template>
<item-descriptor name="registration" default="true" cache-mode="simple">
<table name="blog_registration" type="primary" id-column-name="id">
<property name="username" data-type="string" />
<property name="email" data-type="string" />
<property name="password" data-type="string" />
</table>
</item-descriptor>
</gsa-template>


/ITS/config/its/blog/BlogRepository.properties


$class=atg.adapter.gsa.GSARepository
scope=global
repositoryName=Blog Repository
definitionFiles=/its/blog/BlogRepository.xml
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
dataSource=/atg/dynamo/service/jdbc/JTDataSource
transactionManager=/atg/dynamo/transaction/TransactionManager
idGenerator=/atg/dynamo/service/IdGenerator

Post a Comment

Popular posts from this blog

[Solved] Hive installation error: java.net.URISyntaxException: Relative path in absolute URI

Install Android SDK in centOs

Installing arules package (Association Rules) in R