You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Kees Jongenburger <ke...@framfab.nl> on 2001/07/04 15:16:45 UTC

jsp:include in custom tags

Hi,

can please someone tell me how to dynamically
include file withing a custom tag.

none of the methods seam to work
<% String testpage = "test.jsp"; %> gives:
<jsp:include page="<%= testpage %>"/>

jsp:include needs to have "flush=true"

<% String testpage = "test.jsp"; %>
<jsp:include page="<%= testpage %>" flush="true"/>
Illegal to flush within a custom tag

any clues?



Validating taglibs?

Posted by Kevin Duffey <ke...@home.com>.
Hi all,

My first post to this group...I am the creator of an MVC framework called
Theseus. Its similar to Struts, but in many ways different. None the less, I
was debating writing tag-libs for forms to keep my package small. Being that
Sun and JSR-052 is now using the Jakarta tag-libs for their standard, I
would like to have some sort of support for the various tag-libs. I noticed
however that there are not any form based tag-libs. Is this a plan in the
near future to include a standard set of tag-libs for forms? If not, may I
propose the possible addition of a standardized form set of taglibs..perhaps
one that works with the up and coming Java Faces standard? I would like to
possibly collaborate on adding form based tag-libs that can be standardized
upon with this JSR.

Thank you.


Validating taglibs?

Posted by Kevin Duffey <ke...@home.com>.
Hi all,

My first post to this group...I am the creator of an MVC framework called
Theseus. Its similar to Struts, but in many ways different. None the less, I
was debating writing tag-libs for forms to keep my package small. Being that
Sun and JSR-052 is now using the Jakarta tag-libs for their standard, I
would like to have some sort of support for the various tag-libs. I noticed
however that there are not any form based tag-libs. Is this a plan in the
near future to include a standard set of tag-libs for forms? If not, may I
propose the possible addition of a standardized form set of taglibs..perhaps
one that works with the up and coming Java Faces standard? I would like to
possibly collaborate on adding form based tag-libs that can be standardized
upon with this JSR.

Thank you.


getting xtags to work with Tomcat 3.2.2

Posted by Richard Sand <rs...@vgalleries.com>.
Hi James- that's exactly what was happening.  All I did to make it work was
make sure all of the jar files in xtags were in my classpath, and then I
removed the jaxp.jar and parser.jar that Tomcat 3.2.2 installs with.

Thanks for your help!

-Richard

----- Original Message -----
From: "James Strachan" <ja...@yahoo.co.uk>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, July 10, 2001 8:50 AM
Subject: Re: jsp:include in custom tags


> > Hi all- I'm trying to use the xtags-1.0 tag library example called
> > styledemo.jsp but I'm getting the following exception:
> >
> > javax.servlet.ServletException:
> > javax.xml.transform.TransformerConfigurationException:
> > javax.xml.transform.TransformerException: org.xml.sax.SAXException:
> > Namespace not supported by SAXParser
>
> That sounds like you've got JAXP 1.0 and a SAX 1.0 parser in your
CLASSPATH.
> You might want to consider upgrading to JAXP 1.1 and using the latest
> crimson or xerces JARs.
>
> > I've copied all of the jar files provided with the distribution to my
> > WEB-INF/lib, but I'm wondering if one of the libraries is being
preceeded
> by
> > Tomcat (I'm using tomcat3.2.2) in its TOMCAT-HOME/lib directory.
>
> I think you might be right. How about trying xtags out in Tomcat 4.0?
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>


Re: jsp:include in custom tags

Posted by James Strachan <ja...@yahoo.co.uk>.
> Hi all- I'm trying to use the xtags-1.0 tag library example called
> styledemo.jsp but I'm getting the following exception:
>
> javax.servlet.ServletException:
> javax.xml.transform.TransformerConfigurationException:
> javax.xml.transform.TransformerException: org.xml.sax.SAXException:
> Namespace not supported by SAXParser

That sounds like you've got JAXP 1.0 and a SAX 1.0 parser in your CLASSPATH.
You might want to consider upgrading to JAXP 1.1 and using the latest
crimson or xerces JARs.

> I've copied all of the jar files provided with the distribution to my
> WEB-INF/lib, but I'm wondering if one of the libraries is being preceeded
by
> Tomcat (I'm using tomcat3.2.2) in its TOMCAT-HOME/lib directory.

I think you might be right. How about trying xtags out in Tomcat 4.0?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: jsp:include in custom tags

Posted by Richard Sand <rs...@attglobal.net>.
Hi all- I'm trying to use the xtags-1.0 tag library example called
styledemo.jsp but I'm getting the following exception:

javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException: org.xml.sax.SAXException:
Namespace not supported by SAXParser

I've copied all of the jar files provided with the distribution to my
WEB-INF/lib, but I'm wondering if one of the libraries is being preceeded by
Tomcat (I'm using tomcat3.2.2) in its TOMCAT-HOME/lib directory.  Anyone
have any advice?  Thanks!

-Richard


Re: jsp:include in custom tags

Posted by franciscallo <fr...@thefrancis.net>.

Kees Jongenburger wrote:

> Hi,
> 
> can please someone tell me how to dynamically
> include file withing a custom tag.
> 
> none of the methods seam to work
> <% String testpage = "test.jsp"; %> gives:
> <jsp:include page="<%= testpage %>"/>
> 
> jsp:include needs to have "flush=true"
> 
> <% String testpage = "test.jsp"; %>
> <jsp:include page="<%= testpage %>" flush="true"/>
> Illegal to flush within a custom tag
> 

> any clues?
> 
> 
> 


 

<% String testpage = "test.jsp"; %>
<jsp:include page="<%=testpage%>" flush="true"/>

im i tried running that code and it works fine on mine..

im using tomcat 3.2.2 


what container are you using?

-- 
Francis Dione V. Callo             __
http://www.thefrancis.net       __|__|__
http://www.fracafican.com        (   )
spam-me@spammemore.net          ( . . )
                                 ( ~ )
                                   U


Re: xtag:context and xtag:variable

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "William C. Robertson" <in...@bytetherapy.com>
> For xtags.variable, need I only specify: node="list" to load a
> Java.util.List class loaded with the results of a select?

Yes.

> Thank you for elucidating the use of the "distinct" operator in xpath, I
am
> now able to simplify my xml docs and speed up my code (the zvon tutorial
> doesn't cover that attribute).

The sort and distinct attributes are not part of XPath per se. The <xtags:*>
tags do not match exactly the XSLT tags so there are a few differences (such
as sort & distinct attributes on <xtags:forEach>)

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


RE: xtag:context and xtag:variable

Posted by "William C. Robertson" <in...@bytetherapy.com>.
Thanks for your reply.  I thought about the "superfluous" quality of context
and I can't come up with a case where forEach would not work equally well.

For xtags.variable, need I only specify: node="list" to load a
Java.util.List class loaded with the results of a select?

Thank you for elucidating the use of the "distinct" operator in xpath, I am
now able to simplify my xml docs and speed up my code (the zvon tutorial
doesn't cover that attribute).

Thanks again for your reply and thanks for all your work.

-Bill

-----Original Message-----
From: James Strachan [mailto:james_strachan@yahoo.co.uk]
Sent: Thursday, July 12, 2001 10:40 PM
To: taglibs-user@jakarta.apache.org
Subject: Re: xtag:context and xtag:variable


HI William

From: "William C. Robertson" <in...@bytetherapy.com>
>
> <xtag:context> does not seem to behave the same as it's cousin
> <xtag:forEach>.  For the same path, forEach works but context doesn't.  Is
> there something I'm missing?

<xtags:forEach> is meant to loop whereas <xtags:context> isn't but you're
right apart from that they should be similar.

Do you have an example of something that doesn't work?

<xtags:context> is more intended to help factorize the use of XPath.

 e.g.

<xtags:valueOf select="/customers/customer[@id='123']/name">
<xtags:valueOf select="/customers/customer[@id='123']/address">
<xtags:valueOf select="/customers/customer[@id='123']/email">

Could be

<xtags:context select="/customers/customer[@id='123']">
    <xtags:valueOf select="name">
    <xtags:valueOf select="address">
    <xtags:valueOf select="email">
</xtags:context>


Strictly speaking the above could be accomplished with <xtags:forEach>
instead, the <xtags:context> tag is kinda superfluous but some users liked
it as it explicitly will not loop.


> <xtag:variable> will return "an Object or List" if "node" is not
specified.
> Is the list a list in the sense of a "linkedList" or part of the io
package?
> Where can I find out about how to use it?

I'm in the middle of converting xtags over to the new build process and as a
result I've been doing much more documentation on the attributes used in the
tags, so hopefully in a few days time you'll have some much better
documentation.

Part of the problem is that an XPath expression could result in a String,
Number, Boolean, List or Node. So there is a type attribute to indicate what
type of variable you want. I've found most of the time people want Strings
so I've made string the default. Also it can get a bit ugly using the real
Java class names in JSP so I added some simple aliases as an option as well.

The alias names are:

string
number
list
object
node

The real class names are

java.lang.String
java.lang.Number
java.util.List
java.lang.Object
org.dom4j.Node

One of the main reasons for the <xtags:variable> tag is so that an XPath
expression can be evaluated and the resulting object can be reused several
times by passing it in as the context into other tags like <xtags:forEach>
or <xtags:valueOf>.


> I am currently loading a string array to step through because I haven't
> found an XPath alternative to SQL's "DISTINCT" operator.  Does anyone have
a
> more elegant solution?

The <xtags:forEach> tag has sorting and removing distincts built in. So if
you want to iterate through your customers, in name order removing
duplicates the following should work...

XML...

<customers>
    <customer>
        <name>william</name>
        <location>?</location>
    </customer>
    <customer>
        <name>james</name>
        <location>London</location>
    </customer>
</customer>

<xtags:forEach select="/customers/customer"  sort="name" distinct="true">
    Name: <xtags:valueOf select="name"/>
    Location: <xtags:valueOf select="location"/>
</xtags:forEach>

Where the sort attribute is another XPath expression, evaluated on each
resulting node and is used for the comparison.
Does that help at all?

James

 _________________________________________________________ Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: xtag:context and xtag:variable

Posted by James Strachan <ja...@yahoo.co.uk>.
HI William

From: "William C. Robertson" <in...@bytetherapy.com>
>
> <xtag:context> does not seem to behave the same as it's cousin
> <xtag:forEach>.  For the same path, forEach works but context doesn't.  Is
> there something I'm missing?

<xtags:forEach> is meant to loop whereas <xtags:context> isn't but you're
right apart from that they should be similar.

Do you have an example of something that doesn't work?

<xtags:context> is more intended to help factorize the use of XPath.

 e.g.

<xtags:valueOf select="/customers/customer[@id='123']/name">
<xtags:valueOf select="/customers/customer[@id='123']/address">
<xtags:valueOf select="/customers/customer[@id='123']/email">

Could be

<xtags:context select="/customers/customer[@id='123']">
    <xtags:valueOf select="name">
    <xtags:valueOf select="address">
    <xtags:valueOf select="email">
</xtags:context>


Strictly speaking the above could be accomplished with <xtags:forEach>
instead, the <xtags:context> tag is kinda superfluous but some users liked
it as it explicitly will not loop.


> <xtag:variable> will return "an Object or List" if "node" is not
specified.
> Is the list a list in the sense of a "linkedList" or part of the io
package?
> Where can I find out about how to use it?

I'm in the middle of converting xtags over to the new build process and as a
result I've been doing much more documentation on the attributes used in the
tags, so hopefully in a few days time you'll have some much better
documentation.

Part of the problem is that an XPath expression could result in a String,
Number, Boolean, List or Node. So there is a type attribute to indicate what
type of variable you want. I've found most of the time people want Strings
so I've made string the default. Also it can get a bit ugly using the real
Java class names in JSP so I added some simple aliases as an option as well.

The alias names are:

string
number
list
object
node

The real class names are

java.lang.String
java.lang.Number
java.util.List
java.lang.Object
org.dom4j.Node

One of the main reasons for the <xtags:variable> tag is so that an XPath
expression can be evaluated and the resulting object can be reused several
times by passing it in as the context into other tags like <xtags:forEach>
or <xtags:valueOf>.


> I am currently loading a string array to step through because I haven't
> found an XPath alternative to SQL's "DISTINCT" operator.  Does anyone have
a
> more elegant solution?

The <xtags:forEach> tag has sorting and removing distincts built in. So if
you want to iterate through your customers, in name order removing
duplicates the following should work...

XML...

<customers>
    <customer>
        <name>william</name>
        <location>?</location>
    </customer>
    <customer>
        <name>james</name>
        <location>London</location>
    </customer>
</customer>

<xtags:forEach select="/customers/customer"  sort="name" distinct="true">
    Name: <xtags:valueOf select="name"/>
    Location: <xtags:valueOf select="location"/>
</xtags:forEach>

Where the sort attribute is another XPath expression, evaluated on each
resulting node and is used for the comparison.
Does that help at all?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: xtag:context and xtag:variable

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi William

(I'm reposting this as my previous post seemed to vanish)

From: "William C. Robertson" <in...@bytetherapy.com>
>
> <xtag:context> does not seem to behave the same as it's cousin
> <xtag:forEach>.  For the same path, forEach works but context doesn't.  Is
> there something I'm missing?

<xtags:forEach> is meant to loop whereas <xtags:context> isn't but you're
right apart from that they should be similar.

Do you have an example of something that doesn't work?

<xtags:context> is more intended to help factorize the use of XPath.

 e.g.

<xtags:valueOf select="/customers/customer[@id='123']/name">
<xtags:valueOf select="/customers/customer[@id='123']/address">
<xtags:valueOf select="/customers/customer[@id='123']/email">

Could be

<xtags:context select="/customers/customer[@id='123']">
    <xtags:valueOf select="name">
    <xtags:valueOf select="address">
    <xtags:valueOf select="email">
</xtags:context>


Strictly speaking the above could be accomplished with <xtags:forEach>
instead, the <xtags:context> tag is kinda superfluous but some users liked
it as it explicitly will not loop.


> <xtag:variable> will return "an Object or List" if "node" is not
specified.
> Is the list a list in the sense of a "linkedList" or part of the io
package?
> Where can I find out about how to use it?

I'm in the middle of converting xtags over to the new build process and as a
result I've been doing much more documentation on the attributes used in the
tags, so hopefully in a few days time you'll have some much better
documentation.

Part of the problem is that an XPath expression could result in a String,
Number, Boolean, List or Node. So there is a type attribute to indicate what
type of variable you want. I've found most of the time people want Strings
so I've made string the default. Also it can get a bit ugly using the real
Java class names in JSP so I added some simple aliases as an option as well.

The alias names are:

string
number
list
object
node

The real class names are

java.lang.String
java.lang.Number
java.util.List
java.lang.Object
org.dom4j.Node

One of the main reasons for the <xtags:variable> tag is so that an XPath
expression can be evaluated and the resulting object can be reused several
times by passing it in as the context into other tags like <xtags:forEach>
or <xtags:valueOf>.


> I am currently loading a string array to step through because I haven't
> found an XPath alternative to SQL's "DISTINCT" operator.  Does anyone have
a
> more elegant solution?

The <xtags:forEach> tag has sorting and removing distincts built in. So if
you want to iterate through your customers, in name order removing
duplicates the following should work...

XML...

<customers>
    <customer>
        <name>william</name>
        <location>?</location>
    </customer>
    <customer>
        <name>james</name>
        <location>London</location>
    </customer>
</customer>

<xtags:forEach select="/customers/customer"  sort="name" distinct="true">
    Name: <xtags:valueOf select="name"/>
    Location: <xtags:valueOf select="location"/>
</xtags:forEach>

Where the sort attribute is another XPath expression, evaluated on each
resulting node and is used for the comparison.
Does that help at all?

James



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


xtag:context and xtag:variable

Posted by "William C. Robertson" <in...@bytetherapy.com>.
Hello all,

<xtag:context> does not seem to behave the same as it's cousin
<xtag:forEach>.  For the same path, forEach works but context doesn't.  Is
there something I'm missing?

<xtag:variable> will return "an Object or List" if "node" is not specified.
Is the list a list in the sense of a "linkedList" or part of the io package?
Where can I find out about how to use it?

I am currently loading a string array to step through because I haven't
found an XPath alternative to SQL's "DISTINCT" operator.  Does anyone have a
more elegant solution?

Any help would be greatly appreciated.....


Re: Re[2]: Most useful Tag library Poll

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "daljeetsingh" <da...@softhome.net>
> > Maybe the DBtaglib is the most used library. I mean... I cannot think of
a
> > Web application without DB access.
>
> The DBtaglib approach throws the MVC right out of the window. Is it
> really the way to go?

Right tool for the right job. There is no correct answer or single design
pattern that should be followed religously for all cases. It depends on
complexity.

a) Sometimes doing a full model 1, 2, or pull based MVC architecture
together with EJBs, session beans, entity beans, data access objects and so
forth is useful and necessary. Sometimes its using a sledgehammer to crack a
nut.

b) Sometimes a simple MVC model where model JSP pages do SQL or use beans to
output XML which then gets styled by view JSPs with XSLT is a nice simple
seperation of model from view with custom Java actions (beans and/or
servlets) for the controllers.

c) Sometimes getting a web site up and working fast is more important so
doing a few simple JSP pages with embedded SQL is fine.

Generally though some kind of MVC architecture is recommended for modestly
complex systems. I tend to favour option b) to start with then refactor to
more complex EJB style implementations a) if and when necessary.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re[2]: Most useful Tag library Poll

Posted by daljeetsingh <da...@softhome.net>.
> Maybe the DBtaglib is the most used library. I mean... I cannot think of a
> Web application without DB access.

The DBtaglib approach throws the MVC right out of the window. Is it
really the way to go?

Bye
Daljeet Singh 
ecExperts India 
Ph:- (O) +91-11-4670906
(R) +91-11-7125680 
ICQ:- 75129600
Yahoo:- daljeetsinghmaken 

Re: Most useful Tag library Poll

Posted by Sam Newman <sa...@stamplets.com>.
Personally, the tags I use the most are the request and session tags,
however the ones which do the most amount of work for me are probably the
input tags - those used for form validation/pre-filling.

sam
----- Original Message -----
From: "Howie" <ca...@TooDarkPark.org>
To: <ta...@jakarta.apache.org>
Cc: <ca...@TooDarkPark.org>
Sent: Thursday, July 05, 2001 8:39 PM
Subject: RE: Most useful Tag library Poll


> On Thu, 5 Jul 2001, mihai manuta wrote:
>
> > Maybe the DBtaglib is the most used library. I mean... I cannot think of
a
> > Web application without DB access.
>
> just because a web app talks to a DB doesnt necessarily mean it has to use
> DBTags :)
>
> none of the applications ive seen ( or helped out on ) have used DBTags..
> instead, other Factory classes fetch instances of objects, then provide
> those to the JSP/servlet.
>
> ---
> Howie <ca...@toodarkpark.org>   URL: http://www.toodarkpark.org
>      "This sort of thing has cropped up before and has always been
>       due to human error." -- HAL
>


RE: Most useful Tag library Poll

Posted by Howie <ca...@TooDarkPark.org>.
On Thu, 5 Jul 2001, mihai manuta wrote:

> Maybe the DBtaglib is the most used library. I mean... I cannot think of a
> Web application without DB access.

just because a web app talks to a DB doesnt necessarily mean it has to use
DBTags :)

none of the applications ive seen ( or helped out on ) have used DBTags..
instead, other Factory classes fetch instances of objects, then provide
those to the JSP/servlet.

---
Howie <ca...@toodarkpark.org>   URL: http://www.toodarkpark.org
     "This sort of thing has cropped up before and has always been
      due to human error." -- HAL


RE: Most useful Tag library Poll

Posted by mihai manuta <m....@mrted.com>.
Maybe the DBtaglib is the most used library. I mean... I cannot think of a
Web application without DB access.

Sincerely,
Mihai Manuta
m.manuta@mrted.com
tel: +336.73.56.57.92



Most useful Tag library Poll

Posted by Shelly Mujtaba <sh...@jgsullivan.com>.
Hi,
I am preparing a presentation on Jakarta taglibs for my team. I wanted to
get some opinions from experts on this board.
Basically I am looking for a tag library which you find most useful in your
development work, a brief description of why?,  would be useful also. I hope
to use this taglib for my presentation.

I understand that all of us work in vastly different domains, what useful
for me may not be for you. But I am hoping to find some commonality
eventually.

thanks a bunch.
shelly Mujtaba


-----Original Message-----
From: Kees Jongenburger [mailto:keesj@framfab.nl]
Sent: Wednesday, July 04, 2001 8:17 AM
To: taglibs-user@jakarta.apache.org
Subject: jsp:include in custom tags


Hi,

can please someone tell me how to dynamically
include file withing a custom tag.

none of the methods seam to work
<% String testpage = "test.jsp"; %> gives:
<jsp:include page="<%= testpage %>"/>

jsp:include needs to have "flush=true"

<% String testpage = "test.jsp"; %>
<jsp:include page="<%= testpage %>" flush="true"/>
Illegal to flush within a custom tag

any clues?