Brien Voorhees wrote:

> Duh.  I meant :
> Shouldn't that be <%="i"%>, though?.
> Brien
>

At least for JSP 1.0, it should be:

    <%= i %>

You can actually include any Java expression that returns a string value in such a
scriptlet.  For example, if you have a customer bean with id "customer" that has a
"name" property, you might use the following:

    The customer name is <%= customer.getName() %>.

This is also quite useful when creating input forms where you want the default
value to be the current value in this field.  For example:

    <tr>
        <th>Customer Name:</th>
        <td><input type="text" name="name" size=50
             value="<%= customer.getName() %>"></td>
    </tr>

Of course, using this scriptlet ties you to the underlying language you are using
(Java in this case), because the text must be a valid expression in that language.
Use <jsp:getProperty> if you need a more language-neutral means to retrieve
properties from beans.

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to