jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Holroyd <list-jakarta-taglibs-...@badgers-in-foil.co.uk>
Subject Re: Cooperation
Date Mon, 24 Jul 2000 10:16:35 GMT
At 17:40 21/07/00 -0700, you wrote:
>Hi,
>
>I'm having trouble getting started on my tag library. Since it's rather
>quiet here, I hope it's alright if I ask a novice question:
>
>I want to allow for this type of document:
>
><starteam:server host="starteam" port="1024">
> <starteam:project>
>  <starteam:projectName>Squander</starteam:projectName>
>  <starteam:projectName>Pillage</starteam:projectName>
>  <starteam:promoted object="label" since="thursday">
>   <tr>
>    <td><b><%=label.projectName()%></b></td>
>    <td><%=label.name()%></td>
>    <td><%=label.date()%></td>
>   </tr>
>  </starteam:promoted>
> </starteam:project>
></starteam:server>

You sould really use the syntax:
    <td><b><jsp:getProperty name="label" property="projectName"/></b></td>
    <td><jsp:getProperty name="label" property="name"/></td>
    <td><jsp:getProperty name="label" property="date"/></td>
to do things "the proper way" :)

>I expect this to work this way:
>
>ServerTag keeps the host and port values
>ProjectTag keeps a list of project names
>ProjectNameTag adds to the list in Project
>PromotedTag constructs an object which connects to the server, and iterates,
>evaluating the body.
>
>Now, I need to pass information to the constructor for the object in
>PromotedTag. So, how does this take place? I have something like this:
>
>public class PromotedTagExtraInfo extends TagExtraInfo {
>  public VariableInfo[] getVariableInfo(TagData data) {
>    String object = getAttributeString("object");
>    if (object == null)
>        object == new String("label");
>    return new VariableInfo[] 
>      { new VariableInfo(object, "Blather", true, VariableInfo.NESTED) };
>  }
>}
>
>Can I get access to this object in PromotedTag? Does getVariableInfo
>contstruct the object?

No, TagExtraInfo objects are evaluated at page translation time.  Using
these objects lets you tell the JSP engine to define a variable "label"
with type "Blather" (in your example).

Your PromotedTag class should define a no-args constructor and implement
get/set methods for all your tag attributes. i.e. getObject()/setObject(),
getSince()/setSince()

blatant plug:
If you want an example that implements general iteration, there is one
in the goodtech tag library:
	http://www.goodtechnology.com/products/taglib/

coperative?

David Holroyd

Mime
View raw message