Hi,

For a trial, we modified the template code so that a <template:put> tag with
NO "content" attribute took its content from the tag body.  A <template:put>
with a "content" attribute took its content by including the file named by
the content attribute.  This did away with the "direct" attribute entirely.

The only small issue was what if you had both content attribute and tag
body.  An exception could be thrown.  We just ignore the body, making it
clear in the documentation that this is what happens.

We can send our code if that would help.

Kevin Holloway
Applications Architect
Department for Environment and Heritage
Government of South Australia



-----Original Message-----
From: Tan Siow Boon [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 28, 2000 11:59 AM
To: [EMAIL PROTECTED]
Subject: Re: Templating Mechanism


Hi,

We found the <template:ExtPut> tag extension provided by Oleg V Alexeev very
useful. Is there a plan to incorporate it into Struts 1.0 ?


Regards, SiowBoon

Oleg V Alexeev wrote:

> 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]
>
>   ------------------------------------------------------------------------
>                      Name: ExtPutTag.java
>    ExtPutTag.java    Type:
application/x-unknown-content-type-java_auto_file
>                  Encoding: base64

Reply via email to