我是ATG的新手,我只能用JBoss成功地安装ATGv10.2。
但是,由于在ATG中创建组件和模块可以以不同的方式完成,所以我想知道是否有模块和组件的"Hello“示例。
我已经在谷歌上搜索过了,但互联网上的不同文章并没有按顺序详细地提到点。
因此,如果人们能够详细描述新手的步骤,这将是很棒的,因为我至少需要从一个例子开始,然后我可以用它作为其他复杂示例的基础。
非常感谢在场的每一个人!
注:-
我还在一定程度上了解J2EE和MVC,在那里我可以提交表单并将用户输入的数据保存到DB,而不会有任何重大问题。
我现在也在阅读ATG页面开发人员指南。
发布于 2014-01-11 16:41:56
ATG中有这么多的概念,这使得Hello程序的开发有点困难。您的意思是创建一个JSP页面并像商业参考存储一样部署它吗?您想要创建一个组件来查看Dyn/Admin吗?您想要创建hello world存储库吗?取决于你想要做什么,采取的方法将是不同的。
要使用ATG,您不必知道如何在数据库中保存值。如果您使用J2EE和MVC经验来处理ATG编程,您可能会发现,除非您从一个新的想法开始,否则您可能会发现处理它并不困难,因为ATG中的情况非常不同。
在@radimpe介绍创建hello world液滴时,我将展示如何创建一个简单的组件,以便可以在Dyn/Admin中查看。
创建一个HelloWorld组件:它只出现在DynAdmin中,创建一个具有以下结构的Eclipse项目。

下面是上面屏幕截图中显示的每个文件的内容
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}中,然后运行以下命令以生成项目的ear文件并将其部署到jboss服务器中。
runAssembler.bat -jboss HelloWorld.ear -m EXP_HelloATGComponentWorld导航到Dyn/Admin,搜索组件HelloWorldComponent并单击搜索结果中列出的组件。

单击它,转到component页面,查看我们创建的属性及其在属性文件中的值。

您可以将日志作为类似于此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!的东西来观察,这行是由于我们的doStartService()中的sysout而生成的;您还可以给出可以通过dyn/admin调用或与其他组件交互的其他方法。最好的运气。
发布于 2014-01-06 07:27:53
这是一个相当广泛的主题,一般来说,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页面和类文件(即。在液滴名称中引用这个)
文件: /com/acme/droplet/HelloWorldDroplet.properties
$class=com.acme.droplet.HelloWorldDroplet
$scope=global现在创建您的Java文件:(/com/acme/乳滴/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);
}
}希望这足以让你开始工作。
发布于 2014-10-17 05:09:17
你也可以看看下面的页面。它很好地解释了什么实际上是组件以及我们如何使用它的概念。http://learnoracleatg.blogspot.in/2014/10/art108-extending-out-of-box-components.html
您也可以从基础开始按下导航栏上的“基本”按钮。它很好地解释了这些概念。
https://stackoverflow.com/questions/20943247
复制相似问题