On Fri, 19 Mar 1999, Jarrett Jimmy wrote:
>I was wondering if anyone could explain to me how
>the JSP and XML will work in conjunction with each
>other.   That is, if they will work in conjunction with
>each other at all.
>
There are many possible scenarios for the integration of JSP and XML.

Most obvioulsy, in the same way JSP can be used to transform business data
to an HTML representation, it can also be used to generate XML (presumably for
browsers supporting this format)

Thus, given the following JSP script:

  <@% CONTENTTYPE="text/xml" %>
  <USEBEAN NAME="order" TYPE="com.acme.order.Order" LIFESPAN="page">
    <SETFROMREQUEST BEANPROPERTY="orderNumber">
  </USEBEAN>
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <order>
    <customer>
      <name><DISPLAY PROPERTY="order:customerName"></name>
      <address><DISPLAY PROPERTY="order:customerAddress"></address>
    </customer>
    <line-items>
      <LOOP PROPERTY="order:lineItems" PROPERTYELEMENT="lineItem">
        <line-item>
          <product-name><DISPLAY PROPERTY="lineItem:productName"></product-name>
          <quantity><DISPLAY PROPERTY="lineItem:quantity"></quantity>
          <price><DISPLAY PROPERTY="lineItem:price"></price>
        </line-item>
      </LOOP>
    </line-items>
  </order>

You may get an XML file like:

  <order>
    <customer>
      <name>John Doe</name>
      <address>Somewhere in Cupertino</address>
    </customer>
    <line-items>
      <line-item>
        <product-name>"Immortality" by Milan Kundera</product-name>
        <quantity>1</quantity>
        <price>15.75</price>
      </line-item>
      <line-item>
        <product-name>"Java Servlets" by Karl Moss</product-name>
        <quantity>1</quantity>
        <price>44.95</price>
      </line-item>
    </line-items>
  </order>
--
========================================
Ricardo Rocha
[EMAIL PROTECTED]
http://www.mindspring.com/~rrocha

Nihil humanum me alienum est

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to