Your web application is made up of a series of JavaServer Pages that are generated into wireless-supported files at runtime. Here is the outline of a standard Dynamo wireless JSP:

<%@ page contentType="text/vnd.wap.wml" %>
<%@ taglib uri="/dsp" prefix="dsp" %>

<dsp:page xml=true>

page body

</dsp:page>

This page consists of a page directive, a tag library import statement, and dsp:page, a tag from the imported tag library. You can tell dsp:page is part of the DSP tag library because it uses the established prefix dsp.

Page Directive

The page directive is a standard JSP convention used to specify the file output type. The only necessary difference in a JSP that is output as WML or any other wireless format, such as cHTML, is the value provided to the contentType attribute of the page directive. However, it is likely that if you want your page to output to cHTML, you should use specific cHTML tags in your page content.

You set the contentType attribute to the recognized mime type for a page extension. Here are some common wireless extensions:

Code used in page

File extension

Set contentType to:

JSP only

.jsp

dynamo-internal/jsp

cHTML and JSP

.jsp

text/html

WML only

.wml

text/vnd.wap.wml

WML Compiled only

.wmlc

application/vnd.wap.wmlc

WML Script only

.wmls

text/vnd.wap.wmlscript

WML Script Compiled only

.wmlsc

application/vnd.wap.wmlscriptc

wBitMap only

.wbmp

image/vnd.wap.wbmp

DSP Tag Library

Each tag library referenced in a JSP must be imported at the top of the page. You can use the DSP tag library to code your pages to interact with temporary objects maintained in Dynamo. One of the key strengths in Dynamo is the Nucleus architecture, which consists of objects, called components, that store data for a period of time that you specify (request, session, global). Each component maintains a set of methods and properties. You can use the DSP tag library to represent component and their properties in a page and pass data to and from components.

The JSPs in your web application can incorporate the same dynamic components available to JSPs for HTML output, using the tags provided in the DSP tag library. Because this tag library was designed for both HTML and wireless output, some tags, such as dsp:input, do not apply to wireless pages. In such cases, a wireless-alternative, dsp:postfield, is provided.

The tag you see in the previous code excerpt, dsp:page surrounds the content body of the JSP. You are required to use this tag as such whenever your pages include DSP tag library tags. The dsp:page tag initiates the page rendering process by creating an instance of the DynamoHTTPServletRequest. By setting the xml attribute to true, you cause the page compiler to generate the page’s tags in an XML rather than HTML format. You can skip the dsp:page tag and the DSP tag library import statement if you are not using the DSP tag library.

If you use the JSP templates in the Document Editor to create your JSPs, it automatically inserts the DSP tag library import directive and add opening and closing dsp:page tags in the appropriate locations. For more information about the DSP tag library and the ATG Control Center Document Editor, see the ATG Page Developer’s Guide.

Sample Wireless JSP

The following is a sample JSP that is made up of three cards. The first card displays text (Hello World) and links to the other two cards, which hold the current time and current date respectively. Notice that the servlet bean and dsp:valueof tags are identical to those available to the JSPs for HTML output.

<%@ page contentType="text/vnd.wap.wml" %>
<%@ taglib uri="/dsp" prefix="dsp" %>

<dsp:page>

<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
<dsp:importbean bean="/atg/dynamo/service/CurrentDate"/>

<wml>
  <card id="top" title="Hello World">
    <p>Hello World</p>
    <p><dsp:a href="#time">Current Time</dsp:a></p>
    <p><dsp:a href="#day">Current Day</dsp:a></p>
  </card>

  <card id="time" title="Current Time">
    <p><dsp:valueof bean="CurrentDate.timeAsTimeStamp"
    date="HH:MM:SS"></dsp:valueof></p>
  </card>

  <card id="day" title="Current Day">
    <p><dsp:valueof bean="CurrentDate.dayOfWeekName"></dsp:valueof></p>
      <p>
      <dsp:droplet name="Switch">
        <dsp:param name="value" bean="CurrentDate.dayOfWeekName"/>
        <dsp:oparam name="Saturday">
          <p>Must be the weekend.</p>
        </dsp:oparam>
        <dsp:oparam name="Sunday">
          <p>Must be the weekend.</p>
        </dsp:oparam>
      </dsp:droplet>
      </p>
  </card>
</wml>
Form Handling in Wireless Pages

Dynamo provides a handful of form handlers, which are components that assist in form processing. The input fields in a form are tied to properties in a form handler and when the form is submitted, those inputs are validated to ensure that they provide required data in an acceptable format.

When you create a form, you can use the DSP tag library dsp:go and dsp:postfield tags. The dsp:go tag provides form-building capabilities in much the same way the go tag does with the added benefit that you can incorporate dynamic elements. For example, you might set the href attribute by specifying the getREquestURI attribute of the request object, which always points to the current page. For more information on dsp:go, see the ATG Page Developer’s Guide.

The dsp:postfield tag offers a host dynamic capabilities. Not only can you specify the form handler (bean) that temporarily stores user input, you specify a default value that is itself a bean property value (beanvalue) or page parameter value (paramvalue). The dsp:postfield tag offers other handy functions; see the ATG Page Developer’s Guide.

<p>User Name:<dsp:input type="text" name="login" title="User Name" size="20"
    maxlength="20" bean="ProfileFormHandler.value.login"/></p>

<p>Password:<dsp:input type="password" name="password" title="Password"
  size="35" maxlength="35" bean="ProfileFormHandler.value.password"/></p>

<do type="accept" label="Login">
  <dsp:go href="`request.getRequestURI()`" method="post">
    <dsp:postfield bean="ProfileFormHandler.loginSuccessURL"
     value="index.jsp" />
    <dsp:postfield bean="ProfileFormHandler.value.login" value="$login" />
    <dsp:postfield bean="ProfileFormHandler.value.password"
    value="$password" />
    <dsp:postfield bean="ProfileFormHandler.login" value=" " />
  </dsp:go>
</do>
 
loading table of contents...