Hello Andrew,

Some time ago I write tag to extend template mechanism in this way.
Use it if you find it useful.

This tag can be used like <template:put> tag except one feature - if
you omit content property in it, then body of this tag will be treated
as content. For example -

<template:extput name="body">
 Some content
</template:extput>

Sourse you can find in attachment. This class - whole mirror of PutTag
except some strings of code.

Strings to add to the struts-template.tld

    <tag>
        <name>extput</name>
        <tagclass>org.apache.struts.taglib.template.ExtPutTag</tagclass>
        <bodycontent>JSP</bodycontent>
        <attribute>
            <name>name</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>content</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>direct</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>


Monday, November 13, 2000, 7:45:55 PM, you wrote:

>> The template mechanism in the article is nearly identical to the one in
>> Struts. See org.apache.struts.taglib.template.

AB> I've been looking at the templating code, and
AB> have what I hope is a simple question.

AB> When using direct="true" in the <template:put> tag, 
AB> to place literal text into the template, the text must 
AB> necessarily be very limited because it's contained in 
AB> the value of the content attribute.  What I'd like to be 
AB> able to do is something like:

AB>   <!-- the contents of a specific page -->

AB>   <template:insert template='/pagetemplate.jsp'>

AB>     <template:put name="navigation">
AB>        ... page-specific navigation here ....
AB>     </template:put>

AB>     <template:put name="pagebody">
AB>        ... page body here...
AB>     </template:put>

AB>   </template:insert>

AB> which seems similar to your examples, except that the
AB> contents of the navigation and pagebody sections are
AB> stated in line, instead of loaded from external files,
AB> which I'd rather not do because of how many tiny
AB> little documents that would end up creating.

AB> Is this feasible?  If the tag lib doesn't already 
AB> support this function (and I believe it doesn't),
AB> is it possible to implement, and is it contrary to 
AB> the intent?  I'm not comfortable enough with 
AB> taglib implementation to know if doing it this way
AB> would affect the evaluation of the page body in
AB> some undesirable way.

AB> Andy Boyko   [EMAIL PROTECTED]



-- 
Best regards,
 Oleg                            mailto:[EMAIL PROTECTED]

ExtPutTag.java

Reply via email to