SQL query string appears as part of the HTML text when result set is empty
G'day folks, I've been tinkering with taglibs for the first time today and I've come across something that I cannot seem to find an answer to. Basically when ever a query returns an empty result set the SQL query string itself is appearing as part of the HTML text. The JSP contains the following snipet of code: Requires Immediate Attention Due Council Subject Contact Type SELECT * FROM OVERDUE_2 ORDER BY PRIORITY DESC, TIME_DUE ? "> There are currently no overdue actions requiring attention. The resulting HTML looks like (generated from the code above): Requires Immediate Attention Due Council Subject Contact Type SELECT * FROM OVERDUE_2 ORDER BY PRIORITY DESC, TIME_DUE There are currently no overdue actions requiring attention. I'm running Tomcat 4.1.24 under Windows XP Pro. Early today I downloaded the DBTags binary and installed as per the instructions. I'm assuming the version of DBTags is 1.0 as this appears in the blurb in the index.htm page. The file name was "jakarta-taglibs-dbtags-current". I'd be greatly appreciative if anyone can shed some light on why this is happening. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with c:import (JSTL 1.0)
Thank you. Guess sometimes it just takes a second set of eyes to see the obvious... On Thu, 23 Oct 2003, Karr, David wrote: > Looks like you're missing a ">" at the end of the "c:if". > > -Original Message- > From: Stephen Letschin [mailto:[EMAIL PROTECTED] > > I am having a problem with a c:import that I hope someone has an answer > to. > > > > <%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %> <%@ taglib > uri="http://java.sun.com/jstl/fmt"; prefix="fmt" %> > > > var="lastModDate" > value="10/23/2003" > pattern="MM/dd/" > scope="request" /> > /> > > Thanks. > > Stephen Letschin > [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Stephen Letschin "Life is hard -- Bring your brain." [EMAIL PROTECTED] -- Jim Peak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
I don't think this is possible, as it would require that the JSP be recursively parsed, right? When a tag writes to the output stream, that's going straight to the browser, really - it would need to be reevaluated by the JSP engine, in order to support what you are trying to do, and in theory, it would need to be indefinitely reevaluated, until no more JSP tags exist to be evaluated. In short, I don't think there's an answer to this ... I know Apache2 can now chain filters (so the output from something like mod_jk could be re-evaluated by PHP or something), but I've never seen anything where the same filter/parser/whatever reevaluates its own output. In theory, this would be possible via various scripting hacks, but since Java (and JSP) is compiled, I'd say it would be awfully difficult to achieve - and awfully poor in performance - since the output of YOUR tag would need to be recompiled each time a request came in, since there would be no way to predict (and cache) the output of your tag, right? Very poor performance, indeed! :) Brice Lukas Bradley wrote: Hi all, Maybe I'm just tired, but the answer to this is not to be found. I could me making this harder than it is, or something might be right in front of me, and I don't see it. What I want is a custom tag that creates other custom tags. Here is a simple example: Should produce something like this: English Which should then evaluate to: English I've thought about trying to extend BodyTagSupport, return EVAL_BODY_BUFFERED in doStartTag(), modify the bodyContent in doAfterBody(), then return EVAL_PAGE() in doEndTag(). However, BodyContent has a protected constructor, and no way to set its content. I want to maintain the functionality gained from Struts-like custom tags, while extracting the creation of them in a super-duper momma tag. Any help? Lukas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: Re: Tags creating Tags]
Original Message Subject: Re: Tags creating Tags Date: Sun, 26 Oct 2003 20:03:26 -0600 From: Ruth, Brice <[EMAIL PROTECTED]> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> Organization: Fiskars Brands, Inc. To: Struts Users Mailing List <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> One way of accomplishing what you want to do, I think, is simply making calls to the appropriate Struts classes that are called when is parsed & compiled. Instead of outputting an - just call those methods with the arguments that you would write out as attributes, and you should get pretty close to what you're trying to achieve (without the performance hit ;) Brice Craig R. McClanahan wrote: Lukas Bradley wrote: Hi all, Maybe I'm just tired, but the answer to this is not to be found. I could me making this harder than it is, or something might be right in front of me, and I don't see it. What I want is a custom tag that creates other custom tags. Here is a simple example: Should produce something like this: English Which should then evaluate to: English I've thought about trying to extend BodyTagSupport, return EVAL_BODY_BUFFERED in doStartTag(), modify the bodyContent in doAfterBody(), then return EVAL_PAGE() in doEndTag(). However, BodyContent has a protected constructor, and no way to set its content. I want to maintain the functionality gained from Struts-like custom tags, while extracting the creation of them in a super-duper momma tag. Any help? It's not much help, except in the sense that it will put your search for the answer out of it's misery :-). What you are trying to do is not supported by JSP -- the reason is that custom tags are converted into appropriate method calls at page compile time. After that, they are just executed. To accomplish what you are after, you would need another layer of compilation. You'll need to come up with a different approach to accomplish what you are after. Lukas Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
Lukas, I think you can accomplish what you're looking for using JSP 2.0 and tag files. If I'm correct (I haven't used them yet, only read about), you can create tag files that uses other custom tags. Felipe On Monday 27 October 2003 12:07 am, Lukas Bradley wrote: > I'm surprised a method like this doesn't already exist. This wouldn't be - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
> I think you can accomplish what you're looking for using JSP 2.0 and tag > files. Yep. That's exactly what I'm looking for. Now Tomcat 5 just needs to be released, because I'm stuck with JSP 1.2 for now. *sniff* Thanks for the help everyone. I'm including a snippet from the JSP 2.0 PFD 3. Lukas JSP.8.1 Overview As of JSP version 2.0, the JSP Compiler is required to recognize tag files. A tag file is a source file that provides a way for a page author to abstract a segment of JSP code and make it reusable via a custom action. Tag files allow a JSP page author to create tag libraries using JSP syntax. This means that page authors no longer need to know Java or ask someone who knows Java to write a tag extension. Even for page authors or tag library developers who know Java, writing tag files is more convenient when developing tags that primarily output template text. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
On Monday 27 October 2003 12:46 am, Lukas Bradley wrote: > Yep. That's exactly what I'm looking for. Now Tomcat 5 just needs to be > released, because I'm stuck with JSP 1.2 for now. *sniff* You're lucky - some of the projects I work on are stuck on JSP 1.1 or even JSP 1.0/JServ :-( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Substitute for
unfortunately I started this thread by asking for a struts substitute for c:set : - P I'm working w/ a Servlet 2.2 container... Savan Thongvanh Berkley Technology Services |-+> | | "Ruth, Brice"| | | <[EMAIL PROTECTED]| | | m> | | || | | 10/25/2003 07:54 | | | PM | | | Please respond to| | | "Tag Libraries | | | Users List" | | || |-+> >| | | | To: Tag Libraries Users List <[EMAIL PROTECTED]> | | cc: | | Subject: Re: Substitute for | >| sweet, learn something new everyday :) Thank you!! Kris Schneider wrote: > > > > > > > Ruth, Brice wrote: > >> How exactly do do you do that (creating maps of parameters for >> html:link)? >> >> James Mitchell wrote: >> >>> While I use c:set myself for dynamically creating maps of parameters >>> for >>> use with the html:link tag, Struts does not advocate adding logic into >>> the viewand that's one (of many) reasons you won't find it in the >>> core. >>> >>> Stick with c:set for now. >>> >>> >>> My $.02 >>> >>> >>> >>> -- >>> James Mitchell >>> Software Engineer / Struts Evangelist >>> http://www.struts-atlanta.org >>> 678.910.8017 (c) >>> 770.822.3359 (h) >>> AIM:jmitchtx >>> >>> >>> >>> >>> >>> -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 3:09 PM To: Tag Libraries Users List Subject: RE: Substitute for that's too bad. any workaround suggestions? Savan Thongvanh Berkley Technology Services 515.278.7725 |-+> | | "James Mitchell" | | | <[EMAIL PROTECTED]| | | .org>| | || | | 10/24/2003 02:05 | | | PM | | | Please respond to| | | "Tag Libraries | | | Users List" | | || |-+> > - > ---| | | | To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> | | cc: | | Subject: RE: Substitute for | > - > ---| No -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 (c) 770.822.3359 (h) AIM:jmitchtx > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, October 24, 2003 3:02 PM > To: Tag Libraries Users List > Subject: Substitute for > > > > > > > > Is there a struts substitute for the taglib tag? > Savan Thongvanh > Berkley Technology Services > 515.278.7725 > -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other act
Tags creating Tags
Hi all, Maybe I'm just tired, but the answer to this is not to be found. I could me making this harder than it is, or something might be right in front of me, and I don't see it. What I want is a custom tag that creates other custom tags. Here is a simple example: Should produce something like this: English Which should then evaluate to: English I've thought about trying to extend BodyTagSupport, return EVAL_BODY_BUFFERED in doStartTag(), modify the bodyContent in doAfterBody(), then return EVAL_PAGE() in doEndTag(). However, BodyContent has a protected constructor, and no way to set its content. I want to maintain the functionality gained from Struts-like custom tags, while extracting the creation of them in a super-duper momma tag. Any help? Lukas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
Lukas Bradley wrote: Hi all, Maybe I'm just tired, but the answer to this is not to be found. I could me making this harder than it is, or something might be right in front of me, and I don't see it. What I want is a custom tag that creates other custom tags. Here is a simple example: Should produce something like this: English Which should then evaluate to: English I've thought about trying to extend BodyTagSupport, return EVAL_BODY_BUFFERED in doStartTag(), modify the bodyContent in doAfterBody(), then return EVAL_PAGE() in doEndTag(). However, BodyContent has a protected constructor, and no way to set its content. I want to maintain the functionality gained from Struts-like custom tags, while extracting the creation of them in a super-duper momma tag. Any help? It's not much help, except in the sense that it will put your search for the answer out of it's misery :-). What you are trying to do is not supported by JSP -- the reason is that custom tags are converted into appropriate method calls at page compile time. After that, they are just executed. To accomplish what you are after, you would need another layer of compilation. You'll need to come up with a different approach to accomplish what you are after. Lukas Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
Ruth, Craig, and lurkers, I think what I'm after boils down to a method like this: public String renderTag(PageContext pPageContext, Tag pTagToRender) throws JspException After creating the tag manually, you could pass it to this method, and have it rendered. The return value of a String should be the final output of the Tag. The method would check for BodyTag, IterationTag, etc support, and react to it. This way, the user could embed custom tags (Struts or otherwise) within their own custom tags. I'm surprised a method like this doesn't already exist. This wouldn't be recursive, nor would it recompile on each shot. You may be right in calling this a tad "hackish," but it would be useful, no? I can even think of another method that would be the incredi-hack: public String renderTag(PageContext pPageContext, Tag pTagToRender) throws JspException Where you pass in "" instead of the Tag object itself. Now that would be aggressive. For another approach, the JspFragment interface looks promising. However, I'm stuck with Tomcat 4.1 for now, so JSP 2.0 is out. Lukas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags creating Tags
Lukas Bradley wrote: Ruth, Craig, and lurkers, I think what I'm after boils down to a method like this: public String renderTag(PageContext pPageContext, Tag pTagToRender) throws JspException A look at the JSP Specification will tell you that this would not work at all for a classic tag handler (i.e. implements Tag or implements BodyTag). After creating the tag manually, you could pass it to this method, and have it rendered. The return value of a String should be the final output of the Tag. The method would check for BodyTag, IterationTag, etc support, and react to it. This way, the user could embed custom tags (Struts or otherwise) within their own custom tags. I'm surprised a method like this doesn't already exist. This wouldn't be recursive, nor would it recompile on each shot. You may be right in calling this a tad "hackish," but it would be useful, no? I can even think of another method that would be the incredi-hack: public String renderTag(PageContext pPageContext, Tag pTagToRender) throws JspException Where you pass in "" instead of the Tag object itself. Now that would be aggressive. For another approach, the JspFragment interface looks promising. However, I'm stuck with Tomcat 4.1 for now, so JSP 2.0 is out. I think the approach you suggest is problematic, for many of the reasons that Action chaining is problematic. The most serious issue is that you're trying to use a JSP artifact (a custom tag implementation class) for something it was never designed to do (be a reusable "output generator" outside the context of the very strict and complex lifecycle for tag instances described in the JSP specfiication). "Hackish" does not begin to describe how much trouble this kind of anti-object-oriented approach will lead you to in the long run. The right answer would be to create your own tag class that does exactly what you want. If your tag wants to leverage functionality from existing tag classes (and you don't want to cut-n-paste), either make your class a subclass of the existing one (presuming the stuff you need is already abstracted into useful protected methods), or abstract the stuff you need into utility classes that can be shared between your tag and the standard ones, and then lobby to have the same factoring done in the standard classes. This is the foundational basis on which all Struts tag classes are organized, and has proven to support a pretty rich library of tag class implementations that (in many cases) reuse or specialize protected methods in their subclasses. In no case was a "generate a tag" type of hack considered, because it's not necessary. All that's necessary is applying sound design practices for factoring reusable code into reusable chunks. I won't try to claim that we've done a perfect job at the current factoring, but the existence of something like struts-el (which was basically built on top of the existing tags, without having to rip them apart) is pretty good evidence that we're on the right track. Trying to interfere with the tag instance lifecycle that the JSP page compiler assumes pretty much guarantees you'll end up with disaster. Lukas Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]