Skip to main content

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

#ThankYouCitrisys

MAY 5, 2015 an unforgettable day in my life. Why this award is so special to me? Because, after 8 years (After completion of Engineering), I landed on a good place where they identified me and involved me in the good projects with suitable PMOs. With all their support in Citrisys, I did small things with my involvement. For that, Citrisys, awarded me this "Award of Excellence". This award not shows me the best performance, but, it shows me to work more and more. Thank you Mr.ARA (CEO, Citrisys Solutions) for this award. #ThankYouCitrisys

Citrisys Poster Competition work 02