Hi, I don't think the code makes sense.  It is assumed that a jsp action tag
starts with a opening tag and ends it somewhere in a logical manner, i.e.,
during the translation, the jsp engine has to figure out where the start and end
are. Since the if statement will not be evaluated until runtime, there is no way
to know for sure if the end tag is going to be valid one or the other.

That's my interpretation though.

-Yan

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Eric Suen
Sent: Tuesday, April 06, 2004 2:18 AM
To: [EMAIL PROTECTED]
Subject: question about jsp:element and jsp:attribute


Hi

Is the following code correct?

<jsp:element name="fo:table-column">
  <jsp:attribute name="column-width">
    <jsp:expression>widths[i]</jsp:expression>
  </jsp:attribute>
  <jsp:scriptlet>
    if (bgColors[i] != null) {
  </jsp:scriptlet>
  <jsp:attribute name="background-color">
    <jsp:expression>bgColors[i]</jsp:expression>
  </jsp:attribute>
  <jsp:scriptlet>
    }
  </jsp:scriptlet>
</jsp:element>

tomcat can run, but the generated java code is not correct:
  out = _jspx_page_context.pushBody();
  out.print(widths[i]);
  String _jspx_temp0 = ((javax.servlet.jsp.tagext.BodyContent)out).getString();
  out = _jspx_page_context.popBody();
  out.write("<" + "fo:table-column" + " column-width=\"" + _jspx_temp0 + "\"" +
">");

   if (bgColors[i] != null) {


   }

  out.write("</" + "fo:table-column" + ">");

the second <jsp:attribute/> between <jsp:scriptlet/> was lost.
can I dynamically generate attribute? and in JSP 5.14, jsp:element
only accept jsp:attribute & jsp:body as child element.

I use tomcat 5.0.19

Regards




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to