<rtexprvalue> is NOT just for EL expressions

You can use three kinds of expressions for the value of an attribute (or tag body) that allows runtime expressions.

  1. EL expressions

    <mine:advice user="${userName}" />
  2. Scripting expressions

    image with no caption
  3. <jsp:attribute> standard actions

    <mine:advice>
       <jsp:attribute name="user">${userName}</jsp:attribute>
    </mine:advice>

    Note

    What is this?? I thought this tag didn’t have a body...

Note

<jsp:attribute> lets you put attributes in the BODY of a tag, even when the tag body is explicitly declared “empty” in the TLD!!

The <jsp:attribute> is simply an alternate way to define attributes to a tag. The key point is, there must be only ONE <jsp:attribute> for EACH attribute in the enclosing tag. So if you have a tag that normally takes three attributes IN the tag (as opposed to in the body), then inside the body you’ll now have three <jsp:attribute> tags, one for each attribute. Also notice that the <jsp:attribute> has an attribute of its own, name, where you specify the name of the outer tag’s attribute for which you’re setting a value. There’s a little more about this on the next page...

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset