ATG - How do I start creating an example Hello World component and module?

I am new to ATG, and I have successfully installed ATG v10.2 with JBoss.
However, since creating components and modules in ATG can be done in different ways, so I would like to know if there is any “Hello World” example for a module and component.

I have already searched on Google, but the various articles submitted on the Internet are not mentioned in detail in detail, in sequential order.
So it will be great if people can describe in detail the steps for beginners, since at least I need to start with one example, which I can later use as a base for other complex ones.

Many thanks to everyone!

Note: -
I also know J2EE and MVC to some extent, where I can submit forms and save user input to the database without any significant problems.
I am also currently studying the ATG Page Developer's Guide.

+4
source share
4 answers

There are so many concepts in ATG that make it difficult to develop Hello World. Do you want to create one JSP page and expand it as a store of links in trade? Do you want to create a component for viewing in Dyn / Admin? Do you want to create a hello world repository? Depending on what you want to do, the approach to the solution will be different.

ATG, . ATG J2EE MVC, , , ATG .

@radimpe hello world, , , Dyn/Admin.

HelloWorld: DynAdmin Eclipse .

Elipse project structure

, .

HelloWorldComponent.java

package com.buddha.components;

import atg.nucleus.GenericService;
import atg.nucleus.ServiceException;

public class HelloWorldComponent extends GenericService {

    public String firstStr = "Dummy Value"; /* This value will be overwritten */

    public String getFirstStr() {
        return firstStr;
    }

    public void setFirstStr(String firstStr) {
        this.firstStr = firstStr;
    }

    @Override
    public void doStartService() throws ServiceException {
        super.doStartService();
        System.out.println("Hello ATG Component!");
    }

    @Override
    public void doStopService() throws ServiceException {
        super.doStopService();
        System.out.println("Hello ATG Component! Stops now!");
    }
}

Manifest.mf

Manifest-Version: 1.0
ATG-Required: DafEar.Admin 
ATG-Config-Path: config/
ATG-Class-Path: ./bin/ 

HelloWorldComponent.properties

$class=com.buddha.components.HelloWorldComponent
firstStr=HelloWorld

${DYNAMO_ROOT} , jboss.

runAssembler.bat -jboss HelloWorld.ear -m EXP_HelloATGComponentWorld

Dyn/Admin HelloWorldComponent , .

SearchResults of the component we have just created

, , , . Component Property we have created

21:53:00,485 INFO [stdout] (http-/0.0.0.0:8080-1:ipaddr=127.0.0.1;path=/dyn/admin/nucleus//com/buddha/components/HelloWorldComponent;sessionid=gT4bmHj5WKs1Rf85GN0Z+9Qu) Hello ATG Component! - sysout doStartService(); , dyn/admin . .

: Oracle Commerce

+5

, Hello World , . FormHandlers Droplets, Droplet Hello World . .

<%-- JSTL --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%-- DSP --%>
<%-- This tag library represents the ATG tags --%>
<%@ taglib prefix="dsp" uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" %>

<%-- All, non-static includes will have a wrapping page tag --%>
<dsp:page>
  <%-- A droplet is almost like a servlet, and here you include the name of the droplet you want to call --%>
    <dsp:droplet name="/com/acme/droplet/HelloWorldDroplet">
    <%-- An 'output parameter' matches the name of the 'service parameter' in your droplet. You can have multiple of these --%>
     <dsp:oparam name="output">
       <%-- The 'param' matches the name of the 'setParameter' in your droplet and can also be assigned to a jstl variable below --%>
       Hello <dsp:valueof param="toWhom" />
     </dsp:oparam>
  </dsp:droplet>
</dsp:page>

"". , JSP CLASS (.. )

:/com/acme/droplet/HelloWorldDroplet.properties

$class=com.acme.droplet.HelloWorldDroplet
$scope=global

Java: (/com/acme/droplet/HelloWorldDroplet.java)

public class HelloWorldDroplet extends DynamoServlet {

    public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws ServletException, IOException {
            //This will allow you to pass a parameter to the droplet eg: hello.jsp?who=Peter
        String who = pRequest.getParameter("who");

        //Do a check on whether to display the default value or the one passed in
        if (StringUtils.isEmpty(who)) {
            //'toWhom' is the name of the param on the JSP page
            pRequest.setParameter("toWhom", "World");
        } else {
            pRequest.setParameter("toWhom", who);
        }
        //'output' is the name of the 'oparam' on the JSP page.
        pRequest.serviceParameter("output", pRequest, pResponse);
        }
}

, , .

+5

Check http://www.asknsay.com/creating-new-atg-project-in-eclipse.html to create a new atg application from scratch using eclipse. It also describes how to deploy it to JBOSS 6.1.

+1
source

All Articles