Re: Taglibs, log tags for log4j
Hi Ceki From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] FYI, Jochen Hiller has written logs tags based on log4j. The code seems pretty complete but I am not necessarily a good judge. I have also noticed his code resides under the org.apache.log4j.taglib namespace which hints that the code may be distributed along with standard log4j distribution, i.e. log4j.jar. As far as I know, there are now 3 logging taglibs based on log4j. Actually the log taglib in jakarta-taglibs started life as Joseph Ottinger's logging taglib - which may be one of the 3 you are thinking of. Joe donated his taglib to the taglibs project some time back. Considering competition is good then there is nothing wrong with this state of affairs. However, this also means that there is wasted development effort. Agreed. If Jochen merges his work with the log taglib in jakarata taglibs (which seems likely) then we'll have only one. How about closer coopreation between the taglibs project and and the log4j project? Do you think we could work together to incorporate jakarta-taglib's log tag in log4j? I welcome your suggestions and comments. I think the jakarta-taglib project is a better place for the log taglib since it is a taglib. e.g. it can share work on common build formats, generation of HTML documentation and JSP 1.1, 1.2 TLDs and so on. James _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: Taglibs, log tags for log4j
Hi James, At 14:50 13.07.2001 +0100, James Strachan wrote: Hi Ceki From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] FYI, Jochen Hiller has written logs tags based on log4j. The code seems pretty complete but I am not necessarily a good judge. I have also noticed his code resides under the org.apache.log4j.taglib namespace which hints that the code may be distributed along with standard log4j distribution, i.e. log4j.jar. As far as I know, there are now 3 logging taglibs based on log4j. Actually the log taglib in jakarta-taglibs started life as Joseph Ottinger's logging taglib - which may be one of the 3 you are thinking of. Joe donated his taglib to the taglibs project some time back. If I understand correctly, http://www.adjacency.org/logtags.jsp is no longer pertinent... Considering competition is good then there is nothing wrong with this state of affairs. However, this also means that there is wasted development effort. Agreed. If Jochen merges his work with the log taglib in jakarata taglibs (which seems likely) then we'll have only one. How about closer coopreation between the taglibs project and and the log4j project? Do you think we could work together to incorporate jakarta-taglib's log tag in log4j? I welcome your suggestions and comments. I think the jakarta-taglib project is a better place for the log taglib since it is a taglib. e.g. it can share work on common build formats, generation of HTML documentation and JSP 1.1, 1.2 TLDs and so on. Whatever you deem most appropriate is fine with me. IMHO, pre-packaging log taglib in log4j will give the former a serious boost. This may seem like a silly marketing detail but it can make a real difference for the log taglib. Regards, Ceki -- Ceki Gülcü - http://qos.ch
RE: xtags:ForEach question (involving parameters)
James.. thanks for the tip. As usual, I discovered my problem 15 minutes after I posted to the list ;-) But, now I am trying something different that doesn't seem to work. Here's the new select statement I am trying: select = //person[contains($field, $value)] Where field and value are parameters from the query string. $value seems to work just fine, but the $field part doesn't. Does anyone have any guidelines on what will and won't work when it comes to variable substitution? The xtags documentation is alittle light in this area ;-) Thanks, John Townsend -Original Message- From: James Elson [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:33 AM To: [EMAIL PROTECTED]; John Townsend Subject: Re: xtags:ForEach question (involving parameters) John Townsend wrote: xtags:forEach select = //person[child::name[contains(text(), '$param')]] [...] Select = //person[child::name[contains(text(), 'John')]] Then it works. But, I would like to pass in the 'John' parameter from the URL. The URL would look something like this: http://localhost:8080/myapp/mypage.jsp?param=John Can I do this? I thought if I put $param in my select statement it would work, but it didn't seem to work. I see you're putting the $param inside quotes. Try it without the string delimiters: xtags:forEach select = //person[child::name[contains(text(),$param)]] James _ If you are not the addressee of this confidential e-mail and any attachments, please delete it and inform the sender; unauthorised redistribution or publication is prohibited. Views expressed are those of the author and do not necessarily represent those of Citria Limited. _
Re: xtag:context and xtag:variable
William C. Robertson wrote: 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? Do you have any examples? I'm not sure what sort of behaviour your expecting to be the same. Originally we had only xtags:forEach which would iterate over a node set, and didn't really need xtags:context as you could use an xtags:forEach on a single node to change the context. However, it could be confusing to a page developer as the forEach implied the author expected a multiple node set. Hence the use of xtags:context for selecting a single node: xtags:parse foo bar descriptionSome text/description /bar /foo /xtags:parse xtags:forEach select=/foo/bar xtags:valueOf select=description/ /xtags:forEach xtags:context select=/foo/bar xtags:valueOf select=description/ /xtags:context ...the description will be output the same twice. However, the forEach tag will always have a single node as the context in the body, whereas xtags:context may set a list of nodes. It's also useful when you have a dom4j Document object from somewhere else: % Document doc = myBean.getADocument(); % xtags:context context=doc select=/ ... /xtags:context (although it looks as though this hasn't been fully implemented yet.. the context attribute is listed in the TLD, but has no setter in the ContextTag class. James S?) 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? It'll be a java.util.List (is that right James S?). You can specify the type of the variable to be string (which creates a java.lang.String object with the value of the node(s), node which returns an org.dom4j.Node (useful for further dom4j API manipulation, or setting a context later), or if you specify something else, you'll get a java.util.List of Nodes. If you don't specify a type, you'll get the textual String value. xtags:forEach select=//foo xtags:variable id=attr select=@attr/ The attribute value is %=attr%. That's %=attr% I say. /xtags:forEach Very useful if you need to use the value of a node as a parameter to another custom tag (as you can't use custom tags here), and to reduce the verbosity of a page. James S/MIME Cryptographic Signature
RE: xtag:context and xtag:variable
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:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 10:40 PM To: [EMAIL PROTECTED] Subject: Re: xtag:context and xtag:variable HI William From: William C. Robertson [EMAIL PROTECTED] 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 namewilliam/name location?/location /customer customer namejames/name locationLondon/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: xtags:ForEach question (involving parameters)
John Townsend wrote: xtags:forEach select = //person[child::name[contains(text(), '$param')]] [...] Select = //person[child::name[contains(text(), 'John')]] Then it works. But, I would like to pass in the 'John' parameter from the URL. The URL would look something like this: http://localhost:8080/myapp/mypage.jsp?param=John Can I do this? I thought if I put $param in my select statement it would work, but it didn't seem to work. I see you're putting the $param inside quotes. Try it without the string delimiters: xtags:forEach select = //person[child::name[contains(text(),$param)]] James _ If you are not the addressee of this confidential e-mail and any attachments, please delete it and inform the sender; unauthorised redistribution or publication is prohibited. Views expressed are those of the author and do not necessarily represent those of Citria Limited. _