An ATG form is defined by the dsp:form tag, which typically encloses DSP tags that specify form elements, such as dsp:input that provide direct access to Nucleus component properties. For example, the following JSP embeds a form that accesses the properties in the Student_01
component:
<%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %> <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %> <dsp:page> <html> <head><title>Form Entry</title></head> <body><h1>Form Entry</h1> <dsp:form action="/testPages/showStudentProperties.jsp" method="POST"> <p>Name: <dsp:input bean="/samples/Student_01.name" type="text"/> <p>Age: <dsp:input bean="/samples/Student_01.age" type="text" value="30"/> <p><dsp:input type="submit" bean="/samples/Student_01.submit"/> value="Click to submit"/> </dsp:form> </body> </html> </dsp:page>
In this form, two input tags are associated with the name
and age
properties of the Nucleus component /samples/Student_01
. When this page is displayed, the field for the name
property is filled in with its current value; the field for the age
property specifies the value
attribute, so that value is displayed instead of the current property value.
The form user can enter new values in these fields and submit the form. On submission, the values entered in the form replace the current values of the specified properties, and showStudentProperties.jsp
is invoked, as specified by the form tag’s action
attribute.
Note: The dsp:form
tag requires you to specify the action
attribute.