dsp:input creates a screen object that accepts user input in much the same way the HTML input tag does. You can use dsp:input to create form fields containing user-specified data that is passed to a component. You can also use dsp:input to furnish a submit button that processes a form by making a call to a handler method. This tag must be enclosed in dsp:form tags, which can be provided in the same page or a parent page. See Embedding Pages in Forms for instructions on the latter.

dsp:input defines the input field (text box, radio button group, drop-down list) and it specifies what this value should be saved to (component property, page parameter). Sometimes the input field displays a value, which can be the current value in the property specified for update or another value provided as a default. dsp:input must be used in the context of a form page so it is executed by a submit handler method.

The attribute discussion is divided into a section for input fields and submit buttons, because attribute requirements and definition might vary depending on the screen object you are working with.

Note:dsp:input uses the iclass attribute in place of the cascading stylesheet class attribute to avoid using a Java reserved word in Java code.

Attributes for Input Fields

InputField:type

The type attribute specifies the HTML input control, such as checkbox, radio button, or text box, among others. If a type is not specified, text is used. To learn about input fields, see the Setting Property Values in Forms section.

InputName:name

The name attribute provides a name to a field that is used during form processing. It is not necessary to include a name in dsp:input tags; the ATG platform automatically supplies one if none is specified. For all types other than radio and checkbox, the name value must be unique.

DestinationProperty:bean(Required)

The bean attribute should include the full Nucleus path and component name that you want to update. When you are updating a property, that property should follow the Nucleus path and component name.

<dsp:input type="text" bean="/atg/userprofiling/ProfileFormHandler.name"
required="true"/>

SourceValue:beanvalue,paramvalue,orvalue

You can prepopulate an input field with a value supplied from a designated source. Ordinarily, an input field holds the current value in the destination property so if you are correcting an address, for example, the address displays in its current form for editing. When you supply a source value, that value prepopulates the input fields instead. A source value can include component properties (beanvalue), page parameters (param), or constants (value). This source value is saved to the bean property identified as the bean attribute on form submission.

Attribute

Description

Example

beanvalue

Nucleus path, component name, and property name to display in the input field.

beanvalue="/atg/userprofiling
/profile.login">

paramvalue

Page parameter to display in the input field.

paramvalue="username"

value

Constant value or expression to display in the input field.

value="Ms. User"
or
value="
${user}"

ValueforRadioButtonsorCheckboxes:checked

The checked attribute decides if a checkbox or radio button should appear as selected. This attribute is a Boolean so it accepts runtime values of true (selected) and false (unselected).

DefaultValueforRadiobuttonsorCheckboxes:default

The default attribute lets you specify a default setting to save to the component property when the user neglects to supply a value and none is otherwise provided. Options include true.

OperationOrdering:priority

The priority attribute lets you set a dsp:input tag at a high priority so it is processed before other tags in a JSP. This is especially helpful when making changes to an item’s repository ID and the properties it contains. If you first update the supplemental properties and then the repository ID, the new property values can be flushed when the repository ID change occurs. The priority attribute takes an integer value. By default, priority is set to –10.

For more information on how the ATG platform can prioritize tag processing, see Order of Tag Processing

TagConverters

The tag converter tools let you convert a value into the format of your choice:

  • number

  • currency (including currencyConversion, euro, reverse, and symbol)

  • date

  • maxdate and mindate

  • nullable

  • required

  • creditCard (including groupingsize, maskcharacter, and numcharsunmasked)

  • valueishtml

You can also use tag converters to require users to enter data in a specific format. For more information, see Tag Converters.

Attributes for a Submit Button

InputField:type(Required)

The type attribute invokes the class that implements the submit button. When you insert a button in a page, set this attribute to submit.

HandlerComponent:bean(Required)

The bean attribute identifies the form handler component that processes your form data. This attribute must include the Nucleus path, component name, and handler method you wish to invoke.

<dsp:input type="submit"
bean="/atg/userprofiling/ProfileFormHandler.cancel">

InsertImage:srcorpage

If you choose to use an image as a submit button, you must use one of these attributes to specify that image.

Attribute

Description

src

Path and file name. Resolves relative paths using the current page as a starting point. Resolves absolute paths using the Web server doc root as a starting point.

page

Path and file name. Resolves relative paths using the current page as a starting point. Resolves absolute paths using the Web application root as a starting point by prepending the request object’s context root to the specified value.

OperationOrdering:priority

The priority attribute lets you set a dsp:input tag at a high priority so it is processed before other tags in a JSP. This is especially helpful when making changes to an item’s repository ID and the properties it contains. If you first update the supplemental properties and then the repository ID, the new property values might be flushed when the repository ID change occurs. The priority attribute takes an integer value. By default, priority is set to –10.

For more information on how the ATG platform can prioritize tag processing, see Order of Tag Processing

ButtonLabel:value(Required)

When you create a submit button, you might want to supply a label for it using the value attribute.

<dsp:input type="submit" bean="/TestData/Student_01.age" value="Click
here"/>

Side-EffectValueUpdate:submitvalue

In addition to calling a handler method, you can set a submit button to update the bean or page parameter with the submitvalue attribute. This operation works the same way as the hidden bean. The submitvalue value must be a constant.

<dsp:input type="submit" bean="/TestData/Student_01.age" submitvalue="34"
value="Click here"/>

Example
<%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %>

<%@ page import="atg.servlet.*"%>
<dsp:page>

<dsp:importbean bean="/atg/TestData/StudentFormHandler"/>

<dsp:form action="<%=ServletUtil.getDynamoRequest(request).getRequestURI()%>"
method="POST">
   <dsp:input bean="StudentFormHandler.updateSuccessURL" type="hidden"
    value="index.jsp"/>
   <dsp:input type="hidden" bean="StudentFormHandler.updateRepositoryId"
    beanvalue="StudentFormHandler.repositoryId" />

   <table border=0 cellpadding=2>
      <tr>
        <td align=right>First Name </td>
        <td><dsp:input type="text" bean="StudentFormHandler.value.firstName"
         maxlength="30" size="30" required="true"/></td>
      </tr>

      <tr>
        <td align=right>Last Name </td>
        <td><dsp:input type="text" bean="StudentFormHandler.value.lastName"
         maxlength="30"size="30" required="true"/></td>
      </tr>

      <tr>
        <td align=right>Address </td>
        <td><dsp:input type="text"
         bean="StudentFormHandler.value.primaryResidence.address"
         maxlength="30" size="30" required="true"/></td>
      </tr>

      <tr>
        <td align=right>City </td>
        <td><dsp:input type="text"
         bean="StudentFormHandler.value.primaryResidence.city"
         maxlength="30" size="30" required="true"/></td>
      </tr>

      <tr valign=top>
        <td align=right>State/Province </td>
        <td><dsp:input type="text"
         bean="StudentFormHandler.value.primaryResidence.state"
         maxlength="30" size="30" required="true"/></td>
      </tr>

      <tr>
        <td align=right>ZIP/Postal Code </td>
        <td><dsp:input type="text"
         bean="StudentFormHandler.value.primaryResidence.postalCode"
         maxlength="10" size="10" required="true"/></td>
      </tr>

      <tr>
        <td align=right>Phone Number </td>
        <td><dsp:input type="text"
         bean="StudentFormHandler.value.primaryResidence.phoneNumber"
         maxlength="20" size="30" required="true"/></td>
      </tr>

      <tr>
        <td align=right>Birthday (MM/DD/YYYY)</td>
        <td><dsp:input bean="StudentFormHandler.value.dateOfBirth"
         date="M/dd/yyyy" maxlength="10" size="10" type="text"/></td>
      </tr>

      <tr>
        <td align=right>Gender </td>
        <td>
          <dsp:input type="radio" bean="StudentFormHandler.value.gender"
           value="male">Male</dsp:input>
          <dsp:input type="radio" bean="StudentFormHandler.value.gender"
           value="female">Female</dsp:input>
        </td>
      </tr>

      <tr>
        <td align=right>Graduation Date </td>
        <td>
          <dsp:select bean="StudentFormHandler.value.gradDate"/>
            <dsp:option value="6/2003">2003</dsp:option>
            <dsp:option value="6/2004">2004</dsp:option>
            <dsp:option value="6/2005">2005</dsp:option>
            <dsp:option value="6/2006" selected="true">2006</dsp:option>
        </td>
      </tr>

      <tr>
        <td align=right>Interests </td>
        <td>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="drama" checked="true">Drama</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="art" checked="true">Art</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="studentGovernement" checked="true" >Student
           Government</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="sports" checked="true">Sports</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="band" checked="true">Band</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="academicTeam" checked="true">Academic Team</dsp:input>
          <dsp:input type="checkbox" bean="StudentFormHandler.value.interests"
           value="singing" checked="true">Singing</dsp:input>
        </td>
      </tr>

      <tr>
        <td align=right>Comments</td>
        <td>
          <dsp:textarea bean="StudentFormHandler.value.comments"/>
        </td>
      </tr>

      <dsp:input type="submit" bean="StudentFormHandler.create" value="Register"/>
</dsp:form>
</dsp:page>

The form in this example might be part of a new student registration page. The page begins with the directive statements that import the DSP tag library and the servlet class. This is followed by an import statement that makes the fictitious StudentFormHandler available to the page in the same way as the preceding imported items. This page employs the standard dsp:page tag that is standard in all pages that use the DSP tag library.

The form elements define the default result page as the active page by retrieving the page path and name dynamically from the request objects RequestURI property. The page uses a hidden component to set the StudentFormHandler success property to the index.jsp. Because a failure URL is not provided, the default (current page) is used. A second hidden bean ensures that the repository ID that represents the form remains the same by updating it with the current value.

The dsp:input tags that follow insert text boxes, radio buttons, checkboxes, and extended text fields, that are populated with data when current values exist (implemented by the post action). The first seven text boxes present the student’s first name, last name, street address, city, state, postal code and phone number, and indicate that they must hold valid data in order for the form to process successfully. Each text box saves data to the primaryResidence array of the value Dictionary. The value in the birthday text box is converted so it appears in a format consistent with 1/15/1936.

The form includes a set of radio buttons for documenting the student’s gender (neither are default selected) and a set for specifying is the student’s graduation date. In both cases only one item in each group can be selected. Because most new students are freshmen, the last occurring date is the default. The interests checkbox group saves all selected items to the interests array property. All items are selected by default to encourage students to involve themselves in activities. The extended text box provides a place for free form comments about a student.

The final dsp:input tag inserts a button called Register that, when clicked, invokes the submit handler method to process the form.

 
loading table of contents...