Select (ing) data based upon todays date
Hi all, I am building a small site for a charity, which I am doing for free. I have question I am struggling with.. Here is my query using the database tags. sql:query select ref, descr , start , end from rbh.prjhdr /sql:query start and end are defined as date fields within a mySQL database. My question is - what is the best way to select all recored WHERE end is = today Thanks in advance Kevin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Select (ing) data based upon todays date
Define a java.sql.Date object. You should be able to do this with a jsp:useBean declaration. Then simply pass the declared object using its id attribute as a sql:param value=${beandID}/. Your select statement should be Select * from rbh.prjhdr Where end = ? Kevin Passey wrote: Hi all, I am building a small site for a charity, which I am doing for free. I have question I am struggling with.. Here is my query using the database tags. sql:query select ref, descr , start , end from rbh.prjhdr /sql:query start and end are defined as date fields within a mySQL database. My question is - what is the best way to select all recored WHERE end is = today Thanks in advance Kevin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Need help with x: tags
Can someone advise if it is possible using x: tag in JSTL to obtain the value of an parameter within a tag? For instance, I have a tag: version createdate='2002-03-06T21:45:17' filecreatedate='2002-03-06T21:45:16' filedatasize='25600' filemodifydate='2002-03-06T21:45:16' filename='Migration Issues.doc' fileplatform='2' fileressize='0' filetype='doc' id='6359951' indexed='0' locked='0' mimetype='application/msword' modifydate='2002-03-06T21:45:17' name='1' nodeid='6359949' number='1' owner='4763453' providerid='6359950' providername='EXTSHARED' and would like to retrieve the values for mimetype, filename, filecreatedate, etc. Is this possible with JSTL or should I use the XTags library. TIA. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Taglib bug in Tomcat 4.1?
Is there a bug in Tomcat 4.1 when working with taglibs? First the good news: I have JSP pages using Jakarta taglibs (input, dbtags and application) in a web application webAppA (running on Tomcat 4.1). It works fine. So http://servername:port/webAppA/jspWithTags.jsp in a browser works fine. Bad News: When I move that same jspWithTags.jsp (along with web.xml, .tld and .jar files for the taglibs) to anpther web app webAppB, I get the following error when I open http://servername:port/webAppA/jspWithTags.jsp in a browser: Anybody out there who experienced this problem? Why does the same JSP run fine in one webApp and not in another? I have searched mailing lists, news groups, but no luck. Is this related to Tomat Setup? Regards, r paul type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Cannot inherit from final class at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:380) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:533) at java.lang.Thread.run(Thread.java:479) root cause java.lang.VerifyError: Cannot inherit from final class at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:488) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo ader.java:1664) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav a:953) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1394) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1274) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.createContentDispatcher(Unkn own Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.(XMLDocumentFragmentSc annerImpl.java:248) at org.apache.xerces.impl.XMLDocumentScannerImpl.(XMLDocumentScannerImpl.java:2 45) at
RE: Taglib bug in Tomcat 4.1?
Oops .. correction In second para, the URL is http://servername:port/webAppB/jspWithTags.jsp -Original Message- From: Rajendra Paul [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 12:50 PM To: '[EMAIL PROTECTED]' Subject: Taglib bug in Tomcat 4.1? Is there a bug in Tomcat 4.1 when working with taglibs? First the good news: I have JSP pages using Jakarta taglibs (input, dbtags and application) in a web application webAppA (running on Tomcat 4.1). It works fine. So http://servername:port/webAppA/jspWithTags.jsp in a browser works fine. Bad News: When I move that same jspWithTags.jsp (along with web.xml, .tld and .jar files for the taglibs) to anpther web app webAppB, I get the following error when I open http://servername:port/webAppA/jspWithTags.jsp in a browser: Anybody out there who experienced this problem? Why does the same JSP run fine in one webApp and not in another? I have searched mailing lists, news groups, but no luck. Is this related to Tomat Setup? Regards, r paul type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Cannot inherit from final class at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:380) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:533) at java.lang.Thread.run(Thread.java:479) root cause java.lang.VerifyError: Cannot inherit from final class at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:488) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo ader.java:1664) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav a:953) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1394) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1274) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310) at
Re: Need help with x: tags
Hi Tom, On Thu, 19 Dec 2002, Zvolensky, Thomas J {PGL~Nutley} wrote: Can someone advise if it is possible using x: tag in JSTL to obtain the value of an parameter within a tag? For instance, I have a tag: version createdate='2002-03-06T21:45:17' filecreatedate='2002-03-06T21:45:16' filedatasize='25600' filemodifydate='2002-03-06T21:45:16' filename='Migration Issues.doc' fileplatform='2' fileressize='0' filetype='doc' id='6359951' indexed='0' locked='0' mimetype='application/msword' modifydate='2002-03-06T21:45:17' name='1' nodeid='6359949' number='1' owner='4763453' providerid='6359950' providername='EXTSHARED' and would like to retrieve the values for mimetype, filename, filecreatedate, etc. Is this possible with JSTL or should I use the XTags library. Sure, you can use XPath expressions that use the @ shorthand notation for the attribute axis, so you end up with something like /version/@mimetype This means the attribute 'mimetype' of the tag 'version.' Hope that helps, -- Shawn Bayern JSTL in Action http://www.manning.com/bayern -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[JSTL] Help hiding/showing sections on JSP (w/ cookie?)
I have a JSP with several sections, each of which needs to be hidden or shown based on user preference. I believe I've gotten the code done to toggle the on/off value of each section and to set a persistent cookie for the user in the form of: profile_sections = YYYNNNYYYNYNYNYYNN Now I'm working on the JSP code which will show (or not) each section as required. I don't know what the best way to do this would be. Do I add attributes to the request and then use x:if select={$showAddress} tabletrtdstuff/td/tr/table /x:if Or can I get at the cookie with JSTL? (And pick out a specific position of it??) The setting of the cookie is done in a Struts Action, so I've got Struts (and Struts-EL) tags available if one of those would be easier to use. Bear with me, it's my first cookie. :) If you have a suggestion for a different way to do this, I'm all ears. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management
Re: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
On Thu, 19 Dec 2002, Wendy Smoak wrote: x:if select={$showAddress} tabletrtdstuff/td/tr/table /x:if Or can I get at the cookie with JSTL? (And pick out a specific position of it??) The setting of the cookie is done in a Struts Action, so I've got Struts (and Struts-EL) tags available if one of those would be easier to use. You can indeed read the cookie with expressions like ${cookie.key} in most cases, but you won't be able to get at a character position easily in the cookie -- at least not under JSTL 1.0. However, if you delimit the cookie's value with commas (e.g., Y,N,N,Y,...), you could in principle loop over the cookie's components with c:forEach and set different variables depending on what each individual value equals. The rough form of this solution looks like c:forEach items=${cookie.foo} var=e varStatus=c c:if test=${e == 'Y'} c:set target=${myMap} property=boolean${c.count} value=${true} / /c:if /c:forEach -- Shawn Bayern JSTL in Action http://www.manning.com/bayern -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
Shawn Bayern wrote: On Thu, 19 Dec 2002, Wendy Smoak wrote: x:if select={$showAddress} tabletrtdstuff/td/tr/table /x:if Or can I get at the cookie with JSTL? (And pick out a specific position of it??) The setting of the cookie is done in a Struts Action, so I've got Struts (and Struts-EL) tags available if one of those would be easier to use. You can indeed read the cookie with expressions like ${cookie.key} in most cases, but you won't be able to get at a character position easily in the cookie -- at least not under JSTL 1.0. However, if you delimit the cookie's value with commas (e.g., Y,N,N,Y,...), you could in principle loop over the cookie's components with c:forEach and set different variables depending on what each individual value equals. The rough form of this solution looks like c:forEach items=${cookie.foo} var=e varStatus=c c:if test=${e == 'Y'} c:set target=${myMap} property=boolean${c.count} value=${true} / /c:if /c:forEach Glass houses, stones, and all, but I think it's a yicky solution, far too dependent on nothing ever changing :) If I were doing it I'd explore other options (storing user prefs in a db indexed by a cookie value, for instance) and work off of that. Having position-dependent values seems an invitation to fragility. If you're dead-set on positional keys, maybe just using an integer and doing bit compares (I don't know how/if that works under JSTL, but it's a trivial custom tag) or something... Or just use a custom tag for the YNYNYYNN method, I suppose. Obviously the db (or similar) solution is more robust and mutable. Just my $0.02, sorry :) Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
Glass houses, stones, and all, but I think it's a yicky solution, far too dependent on nothing ever changing :) If I were doing it I'd explore other options (storing user prefs in a db indexed by a cookie value, for instance) and work off of that. Having position-dependent values seems an invitation to fragility. I'm currently storing preferences in a database, but I wanted to move to cookies to avoid the overhead of the database connection. This isn't life or death-- just a convenience to remember what they were looking at last time they used the same computer and browser. If you're dead-set on positional keys, maybe just using an integer and doing bit compares (I don't know how/if that works under JSTL, but it's a trivial custom tag) or something... Or just use a custom tag for the YNYNYYNN method, I suppose. Obviously the db (or similar) solution is more robust and mutable. I'm not dead set on positional keys; that's just what came to mind to store as the cookie. In the Struts action, before it goes to the JSP, I can turn that cookie into anything-- a Map? An array of booleans?? What would be easy to deal with in either JSTL or Struts tags? That's what I came here to ask, really. I don't think reading the cookie with JSTL is the best solution necesarily, I just wondered if it was possible. Thanks! -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management
Re: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
Shawn Bayern wrote: Oh, I definitely agree. Personally, I might just set multiple cookies, unless there were more than perhaps a dozen of them. That was my first thought too, but as I choose to confirm every cookie I get I discourage people from using them ;) Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
Oh, I definitely agree. Personally, I might just set multiple cookies, unless there were more than perhaps a dozen of them. Unfortunately, there are already a dozen, and although we resist adding more sections to that page, I have a handful of requests, one or two of which will probably make it. I thought that was too many to set individual cookies. :( So I'd like to set one cookie, the format of which is open to suggestion, read it in a Struts Action, do whatever with the value, and then use some JSTL tags to decide whether or not to display a given section. Having never done anything of the sort before, either 0010001000 or YYYNNNYYNYNY came to mind. (And an evil coworker suggested turning the first into a decimal number before setting the cookie.) -- Wendy Smoak
Re: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
So I'd like to set one cookie, the format of which is open to suggestion, read it in a Struts Action, do whatever with the value, and then use some JSTL tags to decide whether or not to display a given section. Having never done anything of the sort before, either 0010001000 or YYYNNNYYNYNY came to mind. (And an evil coworker suggested turning the first into a decimal number before setting the cookie.) How about creating yourself a Javabean with a bunch of well-named boolean properties? In your Struts Action, read the flag data from the database, create and populate the bean, and put the bean in session scope to be accessed using the JSTL EL syntax. Brian -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [JSTL] Help hiding/showing sections on JSP (w/ cookie?)
I've heard tell of folks serializing things such as this. If you're not in a distributed environment (or you somehow manage to have a shared directory available to all nodes of the cluser) you could probably do the same. Just either serialize them through the typical means or by using one of the new XML strategies. You could then implement a proxy for getting settings belonging to a given user which could easily be accessed via the JSTL. Doing something along these lines would not only reduce the load on the DB, but enable the user the priviledge of having the same settings on every machine they visited the site from. Wendy Smoak wrote: Oh, I definitely agree. Personally, I might just set multiple cookies, unless there were more than perhaps a dozen of them. Unfortunately, there are already a dozen, and although we resist adding more sections to that page, I have a handful of requests, one or two of which will probably make it. I thought that was too many to set individual cookies. :( So I'd like to set one cookie, the format of which is open to suggestion, read it in a Struts Action, do whatever with the value, and then use some JSTL tags to decide whether or not to display a given section. Having never done anything of the sort before, either 0010001000 or YYYNNNYYNYNY came to mind. (And an evil coworker suggested turning the first into a decimal number before setting the cookie.) -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]