dsp:postfield creates an object that accepts user input much like the WML tag postfield. You can use dsp:postfield to pass data to a component property or page parameter. Sometimes the input field displays with a value, which can be the current value in the property specified for update or another value provided as default.

You can also use dsp:postfield to process a form by making a call to a handler method. When you use this tag, make sure it is enclosed in a dsp:go tag. dsp:postfield must be used in the context of a dsp:go tag so it is executed by a submit handler method.

Attributes for Updates to Page Parameters or Component Properties

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:postfield tags; the ATG platform automatically supplies one if none is specified.

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:postfield 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).

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 to display in the input field.

value="Ms. User"

OperationOrdering:priority

The priority attribute lets you set a dsp:postfield 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

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:postfield type="submit"
bean=/atg/userprofiling/ProfileFormHandler.cancel"/>

OperationOrdering:priority

The priority attribute lets you set a dsp:postfield 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

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:postfield bean="/TestData/Student_01.age" submitvalue="34"
value="Click here"/>

Example

<p>Login:<input type="text" name="login" title="login"/></p>
<p>Password:<input type="password" name="password" title="password"/></p>

<do type="accept" label="<i18n:message key="login"/>">
   <dsp:go href='<%= request.getContextPath() +"/wml/login.jsp"
'
   method="post">
     <dsp:postfield bean="ProfileFormHandler.value.login" value="$login"
     />
     <dsp:postfield bean="ProfileFormHandler.value.password"
      value="$password" />
     <dsp:postfield bean="ProfileFormHandler.login" value="Log in" />
     <dsp:postfield bean="ProfileFormHandler.loginSuccessURL" value="/Form
      Success.jsp" />
   </dsp:go>
</do>

This example shows an excerpt from a login form. Notice that login and password entered by the user in the input fields are saved to WML parameters $login and $password respectively. This makes the login and password available to other tags on the page, so the dsp:postfield tag can save them to the ProfileFormHandler properties. By setting the user inputs to the property values via WML variables, you are able to workaround the dsp:postfield constraint that prevents you from saving the user input to a component property directly.

The dsp:postfield tag calls the login handler method so when a submit button is clicked, the ATG platform validates the login/password pair in the ProfileFormHandler. After the ATG platform accepts the login/password pair, the user is directed to the page identified in loginSuccessURL, which is set to FormSuccess.jsp.

 
loading table of contents...