Hello World Program in ATG

Hello World Program in ATG
[Here ITS - is the project name]

File:# 1  WelcomeDroplet.java
(/opt/dev_server/ITS/ITS/ITSStore/src/com/its/WelcomeDroplet.java)

package com.its;
import atg.nucleus.GenericService;
import atg.nucleus.ServiceException;
import javax.servlet.ServletException;

import atg.servlet.DynamoServlet;
import atg.servlet.DynamoHttpServletRequest;
import atg.servlet.DynamoHttpServletResponse;
import javax.servlet.ServletOutputStream;

import java.io.IOException;

public class WelcomeDroplet extends DynamoServlet{
String name;
public void service (DynamoHttpServletRequest request, DynamoHttpServletResponse response) throws ServletException, IOException {
try
{
ServletOutputStream out = response.getOutputStream();
out.println ("Hello World! My name is "+name);
}
catch (Exception e)
{
System.out.println("You are printing: "+name);
}
}
public String getName () { return name; }

public void setName (String name) {
System.out.println ("setting name attribute to " + name);
this.name = name;
}
}

File:#2   WelcomeDroplet.properties
(/opt/dev_server/ITS/ITS/ITSStore/config/its/WelcomeDroplet.properties)

$class=com.its.WelcomeDroplet
name=Hello World

File:#3  hello.jsp
(/opt/dev_server/ITS/ITS/ITSStore/j2ee-apps/ITS/its.war/hello.jsp)

<dsp:page>

<dsp:droplet name="its/WelcomeDroplet">
<dsp:oparam name="output">
<dsp:valueof param="WelcomeDroplet.name"/>
</dsp:oparam>
</dsp:droplet>
</dsp:page>

After saving all files, follow the following steps

Step:#1 Build Files
cd /opt/dev_server/ITS/build-files
ant -Dserver=store
Step:#2 Deploy
cd /opt/dev_server/ITS/build-files/dev-deployment-specific-files
./store-deploy-ear.sh
Step:#3 Store log
cd /opt/dev_server/ITS/build-files/dev-deployment-specific-files
nohup ./startStoreServerOnJBoss.sh > store.log &
tail -f store.log



The output will be:

Hello World! My name is Hello World

Verify droplet by search in component

Screenshot-1.png

Screenshot-3.png

In the name row you can see the text as “Welcome”. By clicking on “name” you can change the value.




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