Anda di halaman 1dari 12

ATG Interview Questions 1 1.

What are the two methods in a component Ans: getter


s & setters 2. Have you worked with repositories Ans: if you answer yes be ready
to answer questions on cache, implementing a rep ository from scratch, and othe
rs. (please see my post on repositories) 3. Name 2 types of tables Ans: primary
and auxillary 3. Name 2 types of tables Ans: primary and auxillary 4. Have you w
orked on shopping carts Ans: CartModifierFormHandler , ShoppingCartFormHandler 5
. Name 2 types of checkout Ans: Express Checkout, Guest Checkout 6. Difference b
etween Express Checkout and Checkout Ans: Express- Logged in user information ha
s stored Guest- will enter all information (shipping, billing, review steps) and
informat ion is not saved 7. What is BCC Ans: Business Control Center- UI for B
usiness Users (to upload content to Catalo gs, create promotions etc) 8. What ar
e custom dsp tags Ans: Custom tags is written by the developer. Dsp is all ready
to use. you can use to render content dynamically by linking Nu cleus component
s directly to your JSPs. Essentially, the DSP tag libraries let y ou connect you
r JSP content to the Java code at work behind the scenes so you ca n separate yo
ur application logic from your presentation layer. ATG 7 provides you with three
tag libraries: JSTL, DSP/DSPEL, and Core. You can find these tag libraries in /
DAS/taglib. 9. Difference between droplet, FormHandler and servlet: Ans: Servlet
is a java class. Droplet is from ATG Droplet is used to render or put data in t
he db Servlet is used to submit data, it acts as a controller. It is not used to
put d ata. Servlet also renders the portion of JSP page. FormHandlers are used
when there are forms. They help to perform validation for the forms. 10. Differe
nce between dsp and dspel tags Ans: The DSP tag library tags support runtime exp
ressions, such as references to scripting variables. These tags use a id attribu
te to name the scripting variab les they create. The DSPEL tag library tags supp
ort JSTL Expression Language (EL) elements that a re also evaluated at runtime.
These tags often produce a result object named by the var attribute. For custom
tags we need to write the properties file and a class file to define the functio
ns. We need to include a tag file with extension .tld. (tag library d efinition)
and in the droplet include the path of the tag uri <% tag uri ..%> For example
we can write a custom tag to calculate the shipping rate with promot ion and sav
e it and then extend wherever required. 1. What is ATG Dynamo? What is ATG Frame
work? Ans. ATG Dynamo or Dynamo Application Server(DAS) is a J2EE application se
rver f rom Art Technology Group. Atg framework is a Web Application framework fo
r build ing web applications. ATG dynamo implements the ATG framework. The appli
cation f ramework can also be run on all major J2EE application servers (JBoss,
WebLogic, WebSphere etc...). 2. What is the scope of Dynamo Components? Ans. The
re are three different types of scopes for ATG components namely 1. request 2. s
ession 3. Global

Global is the default scope 3. What is Nucleus? Ans.Nucleus is ATG`s open Object
Application Framework. ATG 7 is said to be a co mponent-centric development pla
tform. The ATG 7 Web applications are nothing but individual JavaBean components
assembled together. These JavaBean components ar e configured and linked togeth
er by .properties files within Nucleus. In Nucleus, each service is packaged as
a JavaBean or set of JavaBeans. These Ja vaBeans are configured individually and
mounted into a namespace. The beans then interconnect with the beans representi
ng other services. Nucleus is responsible for interpreting the component configu
rations and the management of the compone nt namespace. Dynamo uses the Nucleus
framework to organize components into a hi erarchical structure (similar to a di
rectory structure). Each Nucleus service ha s a unique Nucleus name. For example
, the default javax.sql.DataSource component is located at /atg/dynamo/service/j
dbc/JTDataSource Nucleus is the core of the entire ATG system. It creates and co
nfigures Nucleus components (also called beans and JavaBeans) and organizes them
into a hierarchi cal namespace, essentially giving them a place to live so they
can be referenced by other components. By reading the .properties files associa
ted with each comp onent, Its Nucleus which figures out that which components ar
e to be used in an application ,initializes them to their default values and how
decides about how they connect to each other. This model makes it easier for th
e developers to bui ld ATG applications by configuring and using the pre-built c
omponents instead of writing a lot of Java code from scratch. 4. What is ATG Rep
ository? Ans.ATG Repository refers to the ATG`s way of accessing the Database th
rough pro grams. It is somewhat similar to what Hibernate offers, Seperating the
Applicati on Logic from that of Database. So Atg repository provides a fine gra
ined abstra ction between the application logic and Database. Thus it supports t
he ATG`s Dat a Anywhere paradigm, the application logic created by developers to
interact wit h data need not change for any change in the source of that data.
ATG repository architecture ensures that the source of the data is hidden behind
the Dynamo Re pository abstraction. It would be easy to change from a relationa
l data source t o another or to an LDAP directory since none of the application
logic would need to change. Once data is retrieved from a data source it is tran
sformed into an object-oriented representation. Manipulation of the data can the
n be done using simple getPropertyValue and setPropertyValue methods. The Reposi
tory API ties in closely with ATG s targeting APIs, so you can retrieve items fr
om the repository based on a variety of targeting rules, as well as retrieving s
pecific identified items. 5. What is Atg Pipeline? Ans Atg Pipeline is a variant
of Servlet Pipeline, In an ATG pipeline the sequen ce of Programs are executed
in a queue. Below is the ATG servlet pipeline /atg/dynamo/servlet/pipeline/Dynam
oHandler /atg/dynamo/servlet/pipeline/TransactionServlet /atg/dynamo/servlet/pip
eline/PathAuthenticationServlet /atg/dynamo/servlet/pipeline/URLArgumentServlet
/atg/dynamo/servlet/pipeline/CookieServlet /atg/dynamo/servlet/pipeline/ContextP
athServlet /atg/dynamo/servlet/pipeline/ServletPathServlet /atg/dynamo/servlet/p
ipeline/SessionServlet /atg/dynamo/servlet/pipeline/DynamoServlet /atg/dynamo/se
rvlet/pipeline/SessionSaverServlet /atg/dynamo/servlet/pipeline/FormLoginServlet
/atg/dynamo/servlet/pipeline/WebApplicationDispatcherServlet /atg/dynamo/servle
t/pipeline/CgiServlet /atg/dynamo/servlet/pipeline/ServletPathDispatcher /atg/dy
namo/servlet/pipeline/FileFinderServlet /atg/dynamo/servlet/pipeline/MimeTyperSe
rvlet /atg/dynamo/servlet/pipeline/MimeTypeDispatcher /atg/dynamo/servlet/pipeli
ne/FileServlet

It starts with the DynamoHandler which adds the Dynamo specific request and resp
onse objects to the request's context. Actually the list of servlets you will s
e e depends on which modules you have running. This is the DAS configuration DPS
a nd other modules can and do add more servlets to the pipeline. 6. What is ATG
tag library? Ans. Atg tag library is a variant of jsp standard tag library. How
ever atg provi des its own set of tag libraries e.g. dsp,dspel, core 7. What is
ATG DPS? What are its elements? Ans7. ATG DPS refers to the ATG Dynamo personali
zation system. It is driven by U ser Profile Data and business rules designed to
deliver the right content to the right user. There are three key elements of th
e ATG DPS personalization System. 1. User Profile Management 2. Content Targetti
ng 3. Targeted E-mail User Profile Management When a person visits a website dri
ven by ATG Dynamo Personalization Server(ATG D PS) website for the first time, T
he person is allowed to create its own User Pro file. Once created, DPS stores t
hat User`s Profile in its database repository. This pr ofile contains a list of
properties that describe the person`s characteristics, such as the name they ent
ered in a registration form or the date of their last l ogin. ATG DPS uses this
profile information stored in its database repository to provided targeted conte
nt to each other. Content Targeting Targeting is the process of displaying 1. Co
ntent items 2. To a particular user 3. At a particular time 4. In a particular c
ontext and 5. On a particular rule set. In the DPS rule based system, business m
anagers create rule sets called content targeters that control how content is di
splayed on the web site. Targeting Email DPS includes a Targeted Email service f
or composing and delivering personalized email using the same profile groups and
targeting rules you use to deliver conte nt on your web site. Also if you have
Dynamo Scenario Server installed, you can use scenarios to deliver targeted emai
l. You can use targeted email to perform b elow activities. 1. Send a confirmati
on message to a new user who registers at your site. 2. Notify frequent customer
s of special sales. 3. Notify all users that have not logged into your site in s
everal months that t heir accounts will be closed soon. 4. Send out a mass maili
ng with each message tailored to its reciepient. 8. Which class to extend while
creating ATG Droplets? Ans8. DynamoServlet.java 9. What are ATG Form Handlers? A
ns9. ATG Formhandler is the intermediate class that comes in between a jsp form
value and its bean class. They are there to evaluate the validity of form data b
efore it is submitted, write data to and read data from a database or repositor
y, and direct the user to different pages, depending on the results of the form
submission 10. What is Base class for all ATG Formhandlers? Ans10. GenericFormHa
ndler.java 1. What is class Heirarchy for ATG Formhandlers?How to create a FormH
andler? At the top of ATG formhandler class heirarchy there exists the DropletFo
rmHandle rinterface. Then come, three different classes provided by Dynamo which
extend t his interface. They are as below atg.droplet.EmptyFormHandler atg.drop
let.GenericFormHandler

atg.droplet.TransactionalFormHandler The EmptyFormHandler is the most simplest t


o implement. It implements the Drople tFormHandler interface and defines blank b
ody implementations of the methods in this interface. GenericFormHandler extends
EmptyFormHandler. It defines the simple implementatio ns of the DropletFormHand
ler interface s methods and the basic error handling logi c. If errors occur in
processing a form that uses GenericFormHandler, the errors are saved and exposed
as properties of the form handler component. TransactionalFormHandler extends G
enericFormHandler, It treats the form processi ng operation as a transaction. Th
ough the methods invoked by this form handler a re processed discretely, but the
ir results are saved simultaneously. The beforeG et and afterGet methods do the
transaction management. This establishes the tran saction before any of your pro
perties are set or handler methods are called. Commerce 2. What is an Order ? An
s : An order is a container for commerce items, shipping groups, payment group s
and relationship objects. 3. What is the ShoppingCart ? It is a session scoped
component for holding current and saved orders. The class of ShoppingCart compon
ent is OderHolder. Shopping.current contains the current order. ShoppingCart.sav
ed contains saved orders. 4. What is a commerce item? A commerce item is order i
tem which holds the catalogRefId , quantity and produc tId. 5. What is a SKU? SK
U is a Stock Keeping Unit which is the actual item deliverable. 6. What is the C
atalog hierarchy? Standard Catalog Category Product SKU Custom Catalog Catalog C
ategory Product SKU 7. How do you display a Catalog? Standard Catalog First, we
can use OOTB RootCategories targeter using TargetingForEach droplet wh ich will
get all the root categories of the catalog which root property is set t o true.
Custom Catalog We will get the user s catalog from the Profile.catalog.allRootCa
tegories property and pass to the ForEach droplet. After getting the root catego
ries in any of the above case, use CategoryLookup d roplet to lookup categories,
ProductLookup droplet to lookup products, and SKULo okup droplet to lookup skus
. We will get the item ids and pass between the pages to display its details. Fo
r example, we will pass the categoryId in the anchor tag in home page. When the
us er clicks on the link, the user will be redirected to the category details Pa
ge where we use CategoryLookup droplet by taking the request parameter catoryId.
He re will get all the child products. Similarly we will set the productId in t
he a nchor tag and pass it to the product details page where we use ProdyctLooku
p dro plet to display the selected product details. 8. What is the difference be
tween Standard Catalog & Custom Catalog? The standard catalog is the single cata
log shown to all users. Each user sees th e same set of categories and products.
The custom catalog allows us to create multiple catalogs which are intended to
s how differently to different users. We can target a catalog to a specific user
o

r an organization depending upon the business rules. For example, we can create
a separate catalog for each country based on locale. Each locale will be having
a separate catalog. 9. What are the steps to create a new commerce item type in
the order repository definition? First in the orderReposiry.xml, create an item
descriptor by extending the defau lt commerce item using inheritance concept suc
h specifying super-type and sub-ty pe. And adding the new properties with new ta
ble under this item descriptor. Next we will create a new java bean by extending
the CommerceItemImpl and adding setters and getters for the properties created
in the new commerce item item de scriptor. Next we will specify the new commerce
item details in the OrderTools.properies. We will specify commerceItemTypeClass
Map and beanNameToItemDescriptorMap 10. How do u create the newly created commer
ce item type into the order? We will setup a map of sku item types to the commer
ce item types in the Commerce ItemManager.properties. Then we will override the
CommerceItemManager s createComm erceItem method. We will take the skuId (catalo
gRefId) and find its SKU item typ e and then from this name we will look up the
map values in the CommerceItemMana ger.properties to search for its related comm
erceItem type to create. 1. How do you add an item to cart? Using addItemToOrder
method of CartModifierFormHandler by passing catalogRefId, quantity and product
Id in the product details page. 2. How do you display items in the cart page? We
will get the current order from the ShoppingCart component. We will pass the Sh
oppingCart.current.commerceItems to the ForEach droplet. 3. How do you update th
e quantity of a commerce item in the cart page? First we will set CheckForChange
dQuantity of the CartModifierFormHandler to true in the JSP page. And for the qu
antity field we will give the name as catalogRef Id. Finally, we will call handl
eSetOrder method of CartModifierFormHandler to up date the quantity. 4. How do u
remove items from cart ? We will set the removalCommerceIds property of CartMod
ifierFormHandler to the it ems and call handleSetOrder method of CartModifierFor
mHandler. This is used to r emove one or more items at the same time. To remove
single item handleRemoveItemFromOrder method of CartModifierFormHandle r. 5. How
do u save the order or cart? We can use SaveOrderFormHandler to save the order.
When we call handleSaveOrder m ethod of SaveOrderFormHandler , the current order
will be saved to the ShoppingC art.saved property and it will create a new orde
r will be set to ShoppingCart.cu rrent. 6. How do u retrieve the saved order bac
k to the current order? We can use ShoppingCart.switch method by passing handleO
rderId which will look u p the order from the order repository and set to the cu
rrent order of ShoppingCa rt. 7. How do u proceed to checkout page? We will call
to moveToPurchaseInfo method of the CartModifierFormHandler which w ill execute
the moveToPurchaseInfo pipeline chain and check the order and commer ce items a
nd validates them. Then, checkout login page will be displayed if the user has n
ot logged yet. Otherwise user will be directed to the shipping page. 8. How do y
ou set the shipping address to the order or shipping group? We use the ShippingG
roup droplet to display all the available shipping addresses . The ShiipingGroup
Droplet will get the available addresses from the Profile s shi pingAddress and
secondaryAddresses properties. Then the user will select the shippingAddress fro
m the list. Then the selected a ddress will be set the current shipping group by
calling the handleApplyShipping Groups method of ShippingGroupFormHandler. We c
an create a shipping group manually by using the ShippingGroupManager.create Shi
ppingGroup by passing the address. After that we call ShippingGroupManager.ad dS
hippingGroupToOrder method.

The user will also select the shipping method and set to the shipping group such
as NextDay , Two Day or Ground. We will use AvailableShippingMethods droplet wh
ich fetches all the shipping meth os names from the Shipping calculators. Each S
hipping Calculator has a property called shiipingMethod. 9. What are the differe
nt relationship objects in the order? ShiipingGroupCommerceItemRelationShip, Pay
mentGroupCommerceItemRelationShip , PaymentGroupShipingGroupRelationShip, Paymen
tGroupOrderRelationShip 10. How do you split items to multiple shipping addresse
s? We call the handleSpliShippingInfos method of ShippingGroupFormHandler to spl
it the item quantity to different shipping group. Then we call handleApplyShippi
ngG roups method ShippingGroupFormHandler. On successful the payment page will b
e di splayed. 1. What is a Nucleus? Nucleus is the central registry for the Java
Beans that contain your applicationlevel logic. It creates and configures Dynamo
components and organizes them into a hierarchical namespace 2. Difference betwe
en dsp: include and jsp:include Dsp imports all objects of type class also, wher
e as jsp imports only primitive types. Jsp includes are dynamic where as dsp inc
lude are for data which is smaller than 64 kb. ATG created the DSP tag library a
s a mechanism for accessing all data types, inc luding those that exist in ATG s
Nucleus framework. Other functions provided by th ese tags manage transactions
and determine how data is rendered in a JSP. It s bes t to use tags from the DSP
tag library only for tasks that involve Dynamo Applic ation Framework (DAF) res
ources. Dsp tag support for the passing of object param eters between pages. In
particular, use dsp:include rather than jsp:include, and use dsp:param rather th
an jsp:param. 3. How to implement shopping cart? ShoppingCartFormHandler 4. What
is the main formhandler you use for Shopping cart? ShoppingCartFormHandler & Ca
rtModifierFormHandler 5. What are the ATG component scopes(global session and re
quest)? (see post on scopes) 6. What are the Advantages of DAF? It is used to ma
intain huge data It has repositories which help is data anywhere architecture. D
ependency injection It can write any object of type 1 call in to the db. Dynamo
messaging using patch bay and jms Inversion of Control design pattern, whereby s
oftware components are discrete Entities coupled together by the Nucleus contain
er, rather than through direct r eference. 7. What is a Component? Java bean and
it s configuration file together known as Component in ATG. A compon ent is use
d to initialize or set the properties of a bean class. 8. How ATG pricing works?
There are two types of pricing. Static pricing and dynamic pricing. In static p
ricing, we will display the listPrice or salePrice of the SKU in the productDeta
ils page without calculating. In dynamic pricing, the list price or the sale pri
ce of the SKU passed the Prici ng Engine to calculate the price. The pricing Eng
ine will execute the pre pricing calculators first and then it lo oks up for the
global and active promotions of the user and applies the promotio ns on the raw
price. The discounted price will be set in the PriceInfo object and is again pa
ssed to the post calculators. Finally, the PriceInfo object holds the price to b
e displa yed to user. For example ItemPricingEngine calculates the price of a co
mmerce item and set th

e price to the ItemPriceInfo object. In the page we will get its price by callin
g the commerceItem.priceInfo.amount which is after discount and commerceItem.pr
i ceInfo.rawTotalPrice is before discount. 9. How do create a promotion? We can
create a promotion in the ACC. The promotions will be stored in the Promo tions
repository. The pricingModels.xml contains different types of promotions s uch a
s Amount Off , Percentage Off, Fixed price which can be applied to item or order
or shipping levels. We will create the PMDL rule while creating the promotion w
hich specifies the ac tual discount rule. 10. How do u apply a promotion to a us
er ? There are two types of promotions, global and user level. If we set the glo
bal p roperty of the promotion to true, then that promotion will be applied to a
ll use rs automatically by the pricing engine. For the user level promotions, we
need to apply them through scenarios. The scen ario has action called applyProm
otion which adds the promotion to the active pro motions of the user profile. Th
en pricing engine picks up the user level promoti ons from the Profile.activePro
motions property. What are the performance issues with ATG? Performance problems
come in many shapes and sizes, but they all mean that the p rocessing of some t
ask is not happening at the expected, and previously observed speed. Performance
issues include CPU utilization problems, slow response times , high levels of d
atabase activity, long running SQL queries, slow CA deployment s, just to name a
few. Which is the IBM product used with ATG? WebSphere Application Server Eclip
se IDE What are derived properties? Enables one repository item to derive proper
ty values from another repository it em or from another property in the same rep
ository item. Difference between Item Cache and Query cache For each item descri
ptor, an SQL repository maintains two caches: Item caches Query caches Item cach
es hold the values of repository items, indexed by repository IDs. Item caching
can be explicitly enabled for each item descriptor. Query caches hold the reposi
tory IDs of items that match given queries. When a q uery returns repository ite
ms whose item descriptor enables query caching, the r esult set is cached as fol
lows: The query cache stores the repository IDs. The item cache stores the corre
sponding repository items. What are different modes caching? Caching modes are s
et at the item descriptor level, through the tag s cache-mode a ttribute. The de
fault caching mode is simple caching. To set a different caching mode on an item
descriptor, set cache-mode to one of the following values: Simple Locked distri
buted (distributed TCP caching) distributedJMS (distributed JMS caching) distrib
utedHybrid (distributed hybrid caching) Which are the handleX methods in any imp
ortant formhandlers? HandleX methods contain the actual function to be performed
. its a method. Like in ProfileFormHandler- handleLogin What are pricelists? Pri
ce Lists allow you to target a specific set of prices to a specific group of cus
tomers. Price lists are managed through a single interface in the ACC. For ex am
ple, price lists can be used to implement business to business pricing where e a
ch customer can have its own unique pricing for products based on contracts, RF
Q and pre-negotiated prices Here are a few interview questions i came across rec
ently.Though Very basic ques

tions this might help the reader in some way. Don t think you will come across s
uc h simple questions if you are aiming a big ATG based project. But surely thes
e q uestions will throw some light into your understanding in ATG Framework. All
the answers are two liners which is just the first line of thought to the quest
ion. ATG Interview Questions What is atg Nucleus?? Nucleus is a ATG container fo
r components. It creates and initializes component instances on request. It mana
ges the components scope. It locates the properties file for the component and t
hrough that it reaches the class file of the compon ent. Nucleus components are
Java Objects each with an associated .properties fil e which store configuration
values. What is MANIFEST file? Applications often depend on other modules, thes
e dependencies are declared in t his file.The file name is MANIFEST.MF and resid
es in the META_INF directory. It specifies ATG-Class-Path,ATG-Required, ATG-Conf
ig-Path etc. How a component is instantiated ?? One can start or stop components
manually using an ACC. OR. We can instruct nucleus to start a component during
server startup, this is done by modifying the Initial.properties file.Add the co
mponent name to the initialServ ices property inside the Initial.properties file
. Differentiate Global,Request & session scopes. Global: components are accessib
le from all other components.Not available across ATG servers, each server has i
ts own copy of global scoped component. Session: means every user of the applica
tion gets a separate copy of the compone nt, and component exists for duration o
f the user s session. Request : A component is called in for returning the value
s of a search, so each time a search is triggered an object instantiation happen
s and its gone when th e result page is closed.Which means the scope of the sear
ch component is request .Eg:-formhandlers normally have a request scope. What is
a context root? Is a URL mounting point of the web application. It decides what
URL site site vi sitors will enter to get to the site. Eg: http://www.atg.com/
context-root context-r oot is specified in the application.xml file in the j2eeapps folder., What is ATG Dynamo? What is ATG Framework? ATG Dynamo or Dynamo Ap
plication Server(DAS) is a J2EE application server from A rt Technology Group. A
tg framework is a Web Application framework for building w eb applications. ATG
dynamo implements the ATG framework. The application framew ork can also be run
on all major J2EE application servers (JBoss, WebLogic, WebS phere etc...). What
is the scope of Dynamo Components? There are three different types of scopes fo
r ATG components namely request session Global Global is the default scope What
is Nucleus? Nucleus is ATG`s open Object Application Framework. ATG 7 is said to
be a compon ent-centric development platform. The ATG 7 Web applications are no
thing but ind ividual JavaBean components assembled together. These JavaBean com
ponents are co nfigured and linked together by .properties files within Nucleus.
In Nucleus, each service is packaged as a JavaBean or set of JavaBeans. These J
a vaBeans are configured individually and mounted into a namespace. The beans th
en interconnect with the beans representing other services. Nucleus is responsib
le for interpreting the component configurations and the management of the compo
ne nt namespace. Dynamo uses the Nucleus framework to organize components into a
hi erarchical structure (similar to a directory structure). Each Nucleus servic
e ha s a unique Nucleus name. For example, the default javax.sql.DataSource comp
onent is located at /atg/dynamo/service/jdbc/JTDataSource Nucleus is the core of
the entire ATG system. It creates and configures Nucleus

components (also called beans and JavaBeans) and organizes them into a hierarchi
cal namespace, essentially giving them a place to live so they can be reference
d by other components. By reading the .properties files associated with each com
p onent, Its Nucleus which figures out that which components are to be used in a
n application ,initializes them to their default values and how decides about ho
w they connect to each other. This model makes it easier for the developers to b
ui ld ATG applications by configuring and using the pre-built components instead
of writing a lot of Java code from scratch. What is ATG Repository? ATG Reposit
ory refers to the ATG`s way of accessing the Database through program s. It is s
omewhat similar to what Hibernate offers, Seperating the Application L ogic from
that of Database. So Atg repository provides a fine grained abstractio n betwee
n the application logic and Database. Thus it supports the ATG`s Data An ywhere
paradigm, the application logic created by developers to interact with da ta nee
d not change for any change in the source of that data. ATG repository arc hitec
ture ensures that the source of the data is hidden behind the Dynamo Reposi tory
abstraction. It would be easy to change from a relational data source to an oth
er or to an LDAP directory since none of the application logic would need to cha
nge. Once data is retrieved from a data source it is transformed into an obje ct
-oriented representation. Manipulation of the data can then be done using simp l
e getPropertyValue and setPropertyValue methods. The Repository API ties in clo
sely with ATG s targeting APIs, so you can retrieve items from the repository ba
se d on a variety of targeting rules, as well as retrieving specific identified
ite ms. How to create a form using ATG Framework A Form is collection of compone
nts i.e input controls such as text box, radio bu tton.... Web Applications requ
ire forms to get input from the user. For e.g You might need user information to
register to your website or credentials to log in to your website... In this ar
ticle, Let us see how to create a form using ATG(A RT TECHNOLOGY GROUP). A Form
can be created in ATG as shown below. <dsp:form action= simple.jsp method= post
> <dsp:input type= text name= Emp_name bean= /com/src/Employee.empname /> <dsp:i
nput type= password name= Emp_name bean= /com/src/Employee.empname value= /> <ds
p:input type= submit value= Submit /> </dsp:form> The tag dsp:form requires a ac
tion attribute and method attribute. The action at tribute specifies the next ac
tion to be carried out on form submission. The meth od holds the method name tha
t is used to submit the form (Refer HTML FORM METHOD S). Form Elements can be cr
eated as shown in the above example dsp:input tag is used to create the form com
ponents to get input from the user. dsp:input can create two kinds of controls:
A form field that gets input from the user that is passed to a component. A subm
it button or image for the submission of the form. All dsp:input tags must be em
bedded between <dsp:form>..</dsp:form> tags. The syntax of a dsp:input tag is as
shown below <dsp:input [type="input-control"] [name="input-name"] bean="propert
y-spec" ["sou rce-spec"][checked="{true|false}"] [default="value"][priority=inte
ger-value]/> The attributes of dsp:input are as follows Type The Type attribute
specifies the HTML input type such as a checkbox, radio butto n, or text box, if
type is specified, the default type Text is considered as the i nput type. The
attribute type can hold the below values. Text used to create a text box. Checkb
ox- used to create a check box. Radio- used to create a radio button. Submit- sp
ecifies to display a submit button. Image - specifies a submit control that uses
the image specified by the src or p ageattribute. Password - To create text box
for pasword .

Based on the type of input the other attributes of a dsp:input tag varies, For E
xample a check box control has an attribute checked (to check or uncheck) which
is not applicable for a input of type Text i.e. text box. Name The Name attribu
te assigns a name to the input field, which enables access to it during form pro
cessing. The name must be unique for all input types other than radio and checkb
ox. Bean The Bean attribute specifies the property that this input field updates
on form submission. For Example in the below code the control emp_name refers t
o bean Component Empl oyee and property empname. On Submission of the form the v
alue specified in the text box is set to the bean component s property which can
stored for future use. <dsp:input type= text name= Emp_name bean= /com/src/Empl
oyee.empname /> Checked The checked attribute is applicable only if the type is
set to a checkbox or rad io. The checked attribute is used to check or uncheck a
radio button or checkbox . Default The default attribute specifies the default
value of the component. If no input is specified the default value is set to the
component s property. Priority The priority attribute specifies the priority of
this input field during form pr ocessing, relative to other input fields. Value
The attribute value id valid only if the type attribute is set to submit. Value
is the value set for submit button slabel. Embedding custom attributes A dsp:in
put tag can embed one or more custom attributes by using the dsp:tagAttr ibuteta
g. The syntax of a dsp:attribute tag is as follows. <dsp:input ...> dsp:tagAttri
bute name="attr-name" value="value"/> <dsp:input/> The tag dsp:tagAttributetags
is specifically used to add attributes to the gener ated HTML beyond the fixed s
et of attributes supported by the DSP tag library. <dsp:form action="DoctorAppoi
ntment.jsp" method="post" synchronized="/atg/droplet/DoctorAppointmentFormHandle
r"> Patient Name: <dsp:input type="text" bean=" AppointmentDetails.patientName"/
> Appointment Date: <dsp:input type="text" bean=" AppointmentDetails.appDate"/>
Appointment Time: <dsp:select bean="AppointmentDetails.appTime"> <dsp:option val
ue="10.00am">10 am</dsp:option> <dsp:option value="10.15am">10.15 am</dsp:option
> <dsp:option value="10.30am">10.30 am</dsp:option> <dsp:option value="10.45am">
10.45 am</dsp:option> <dsp:option value="11.00am">11 am</dsp:option> </dsp:selec
t> Gender: <dsp:input type=radio bean=" AppointmentDetails.gender" value="male">
Male</dsp:input> <dsp:input type=radio bean=" AppointmentDetails.gender" value="
female"/>Female</dsp:input> <dsp:input type="submit" value="Create Appointment"
bean=" DoctorAppointmentFormHandler.create"/> </dsp:form> The above example demo
nstrates a form for booking a doctor appointment online. U sing this form, a use
r can specify: Patient Details Appointment Time

Appointment Date When a user clicks Create Appointment, the data entered in the f
orm is saved to the DoctorAppointmentFormHandler and authorized, and basic Form
handler validati on are done and saved to the database if the user has enetered
a valid data, the formhandler returns error message for invalid data. since this
example uses the post method, the form is pre-populated with the data last-save
d to DoctorAppoin tmentFormHandler.

Anda mungkin juga menyukai