Suggestion regarding StandardWrapper class
Hi all, I have a suggestion regarding the StandardWrapper class in Tomcat 5.5.4. It contains a loadServlet() method that catches Throwable when trying to create the servlet using reflection, but doesn't print a stack trace. The stack trace would have been very useful in a case I ran into. I was migrating an app from 5.0.28 to 5.5.4, and my Struts servlet wouldn't load. But the error message just said Error instantiating servlet class org.apahce.struts.action.ActionServlet without the root cause. In the spirit of open source, I built Tomcat from source after adding an appropriate e.printStackTrace(). The problem was NoClassDefFoundError: org/apache/commons/collections/FastHashMap. My WAR did not include the Apache Collections JAR because Tomcat 5.0.28 already had it. But apparently 5.5.4 doesn't have it (or at least doesn't share it with web apps--I haven't checked). In retrospect I'm thinking that I should probably have packaged the Apache Collections JAR in my WAR since I can't really assume that the server environment will provide it, but I guess the point is that a stack trace would have made the problem easy, whereas not having a stack trace makes it difficult. Anyway, I'm finally looking forward to playing with JDK 1.5 now... :-D Willie __ Do you Yahoo!? All your favorites on one personal page Try My Yahoo! http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Suggestion regarding StandardWrapper class
Willie, You shoud probably send this e-mail to Tomcat developer list as well. Thank you, Edmon Willie Wheeler wrote: Hi all, I have a suggestion regarding the StandardWrapper class in Tomcat 5.5.4. It contains a loadServlet() method that catches Throwable when trying to create the servlet using reflection, but doesn't print a stack trace. The stack trace would have been very useful in a case I ran into. I was migrating an app from 5.0.28 to 5.5.4, and my Struts servlet wouldn't load. But the error message just said Error instantiating servlet class org.apahce.struts.action.ActionServlet without the root cause. In the spirit of open source, I built Tomcat from source after adding an appropriate e.printStackTrace(). The problem was NoClassDefFoundError: org/apache/commons/collections/FastHashMap. My WAR did not include the Apache Collections JAR because Tomcat 5.0.28 already had it. But apparently 5.5.4 doesn't have it (or at least doesn't share it with web apps--I haven't checked). In retrospect I'm thinking that I should probably have packaged the Apache Collections JAR in my WAR since I can't really assume that the server environment will provide it, but I guess the point is that a stack trace would have made the problem easy, whereas not having a stack trace makes it difficult. Anyway, I'm finally looking forward to playing with JDK 1.5 now... :-D Willie __ Do you Yahoo!? All your favorites on one personal page Try My Yahoo! http://my.yahoo.com - 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]
Re: Suggestion regarding StandardWrapper class
Better yet, create a bugzilla enhancement request for TC5 and attach your patch (see http://jakarta.apache.org/site/source.html#Patches). Mark Edmon Begoli wrote: Willie, You shoud probably send this e-mail to Tomcat developer list as well. Thank you, Edmon Willie Wheeler wrote: Hi all, I have a suggestion regarding the StandardWrapper class in Tomcat 5.5.4. It contains a loadServlet() method that catches Throwable when trying to create the servlet using reflection, but doesn't print a stack trace. The stack trace would have been very useful in a case I ran into. I was migrating an app from 5.0.28 to 5.5.4, and my Struts servlet wouldn't load. But the error message just said Error instantiating servlet class org.apahce.struts.action.ActionServlet without the root cause. In the spirit of open source, I built Tomcat from source after adding an appropriate e.printStackTrace(). The problem was NoClassDefFoundError: org/apache/commons/collections/FastHashMap. My WAR did not include the Apache Collections JAR because Tomcat 5.0.28 already had it. But apparently 5.5.4 doesn't have it (or at least doesn't share it with web apps--I haven't checked). In retrospect I'm thinking that I should probably have packaged the Apache Collections JAR in my WAR since I can't really assume that the server environment will provide it, but I guess the point is that a stack trace would have made the problem easy, whereas not having a stack trace makes it difficult. Anyway, I'm finally looking forward to playing with JDK 1.5 now... :-D Willie __ Do you Yahoo!? All your favorites on one personal page Try My Yahoo! http://my.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
In NY? Snowed in? Know TC5.5?
Hi, I need help porting an application from Tomcat 3.3 to Tomcat 5.5. I could spend the day plowing through documentation and figuring out the new philosophy or I could spend an couple of hours with someone very knowledgeable who would help me do this, answer my questions and get paid fairly in return. Reply or call 917 535 4838. __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What is it mean that Java code does not belong in well designed JSP pages?
I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Tony LaPaso wrote: Incidentally, in reading the Tomcat docs for Classloading, it seems that any classes in a web app's lib directory *should* be able to see classes in the shared/lib directory. Similarly, any classes in shared/lib *should* be able to see what's in common/lib. This works as you expect. I just tested it with a clean TC5 build from CVS. That being said I noticed the following whilst I was testing which may help: - I needed to clean out the work directory for my app between each test. - I needed to restart Tomcat for each test. If I didn't do both of the above then various caches (already loaded classes, JSPs that have already been compiled, etc) all contributed to weird results. angry-rant The crappy, incomplete Tomcat documentation strikes again. One of the bad things about these open source projects is that since no one owns them no one has responsibility to work on anything except what they're interested in. The result is often neglected, shoddy and incomplete documentation. /angry-rant You are as much of the Tomcat community as anyone else. If you know somewhere where the docs are wrong (which you must do to be able to call them crappy and incomplete - and by implication neglected and shoddy) why not redirect your energy from futile ranting into creating patches to improve the documentation and contribute to the community. So, again, it seems weird that putting the JSTL JARs in common/lib works fine while putting them in shared/lib doesn't. When I put them in shared/lib I get the exception shown below. From the exception below it seems to me that the classes in common/lib (e.g., javax.servlet.http.HttpServlet) do not have access to classes in shared/lib (e.g., org.apache.taglibs.standard.tag.rt.core.ForEachTag) although the classes in common/lib *DO* obviously have access to classes in a web app's lib directory. If only the classloader docs were better In terms of the hierarchy, the docs are right. Perhaps what needs to be added is the circumstances where restarts (app or tomcat) are required for changes to take effect. For the record, my own view is that the increased effort required to manage shared jars is rarely worth the disk space and memory it saves. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
I certainly wouldn't presume to speak for Craig, so this is just my own answer... Scriplets, that is, code in JSPs inside % %, is generally considered a Bad Thing(tm) because it's too easy for business logic to sneak into the presentation. Now, there is I think room for debate about how far to push that idea. Some people think that a JSP should be absolutely nothing more than a template for display, so you should wind up with nothing but things like $=someVar%, or more correctly, something like bean:write name=myBean property=myVar /. However, where there is room for debate is whether using any sort of logic whatsoever in a JSP is bad or not. Taking the JSP as a template only idea to it's fullest extent seems to me to imply that logic in ANY form is to be avoided, and should not be done in a JSP, whether it's using taglibs or not to do it (i.e., logic:equal/ shouldn't even be used because it's logic). I think this is too extreme and limits the types of applications you can do... try doing the kinds of apps I do for a living for example, which are webapps that look, feel and work like fat clients, and you'll be hard-pressed to pull off the kinds of things I do without some level of logic in JSPs. That being said, good design dictates that you need to be careful what gets put in your JSPs, whether you use custom tags or not (I'm not a fan of custom tags myself in most cases). Business logic does NOT belong in JSPs, and indeed anything other than trivial bits of code probably shouldn't be there either. I'm not entirely sure what the code you posted is doing, but my gut feeling is that it's too much for a JSP. I do things like this all the time; % boolean altRow = false; String rowStyle = ; for (Iterator it = form.getTOAList().iterator(); it.hasNext(); ) { if (altRow) { rowStyle = cssListboxAltRow; altRow = false; } else { rowStyle = ; altRow = true; } HashMap nextItem = (HashMap)it.next(); BigDecimal toaID = (BigDecimal)nextItem.get(toaID); String status = (String)nextItem.get(status); % tr height=24 class=%=rowStyle% td%=status%/td td%=toaID%/td /tr % } % ...and some will say that's way too much... let's skip the this should be a custom tag! argument for the time being... This kind of code I see no problem with being in a JSP. It's strictly presentation-oriented, and isn't extensive. That being said, NOW we can get to the this shouldn't be there at all argument... it is a perfectly reasonable argument. In an environment where you have page authors and Java coders, you don't want your page authors to have to see code like that. In fact, in the perfect environment where it's split exactly right, they wouldn't even know what this code meant. But, if you had a custom tag that encapsulated that functionality, they could just put showTOAList/ and be done with it. That's the argument for taglibs (the main one anyway). However, you have to ask yourself what kind of environment your in... I dare say most environments are NOT set up that way... maybe they should be, but I don't think the majority are... most places, your page authors are your Java coders are your database developers are your business analysts, etc. In that case, I think the argument doesn't carry as much weight. Eh, I guess I'm off on a bit of a tangent. Most people will tell you that code in JSPs is to be avoided, and I'm not going out of my way to debate that. But, I think it's fair to say that if you do have code in JSPs, it should be (a) trivial and (b) strictly presentation-related. Breaking THOSE rules, which by extension breaks the higher rules, is to be avoided at all costs. Just my opinions. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . - To
Re: What is it mean that Java code does not belong in well designed JSP pages?
The intent of JSP is that it is primarily HTML with just enough Java to make things work. Ideally, you can hand a JSP to a web designer who is not a programmer and they can make a pretty web page that works. In some shops this works. As a productivity booster, this works in some shops. But in others it is a miserable failure. With that being said, my _personal_ experience is that programming in HTML tags is a pain in the %taglib/. I don't have a problem learning another language to do a job - I regularly use COBOL, Pascal, Java, and SQL in any single project. Adding a JSP front end adds JavaScript, a couple of XML namespaces, and HTML to the mix. Using taglibs instead of code adds a level of obfuscation that, IMHO, makes it difficult to get work done. I always end up taking the servlet that was generated from the JSP and rewriting it so it works correctly, performs adequately, and generates no side effects. This is a battle that will never be resolved because both sides are right, depending on the circumstances. JSP purists will shoot me, but I'll take plain old Java code over HTML taglibs any day. Write JSP's in accordance with your shop's standards and make them work in the time allotted to the task. Ultimately, your company pays the bills, so whatever gives your shop the best productivity is the right choice. On Sun, 2005-01-23 at 09:07, Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - 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]
Re: What is it mean that Java code does not belong in well designed JSP pages?
David Johnson wrote: Using taglibs instead of code adds a level of obfuscation that, IMHO, makes it difficult to get work done. I always end up taking the servlet that was generated from the JSP and rewriting it so it works correctly, performs adequately, and generates no side effects. This has always been my biggest problems with taglibs too, that and the fact that it's yet something else a new developer coming on to a project has to learn before they can be effective (or at least optimally effective). I prefer all the code being right there in front of me, not having to go hunt down source somewhere. Additionally, I don't like having to recompile a class to make a change and then redeploy the class (or worse yet, the whole app). If it's just in a JSP, I can update the app on-the-fly (assuming JSP compilation is still active). That being said, I actually like the idea of Tag Files. It's not quite as bad, it's no worse than a JSP include, although the point about more to learn still stands. But, then it's just usual JSP code, which they would already know, so it's still not quite as bad in that regard either. It's kind of amazing that a lot of people don't even know about that capability. Like you said though, what works in one environment may not work in another, and taking a hard stand either way is a bad idea. Heck, I've used taglibs on plenty of occasions and it's worked out beautifully. Right tool for the job and all that jazz, right?!? -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reload log4j.properties on-the-fly?..servlet approach
Hi I was thinking about a servlet approach, a initialization servlet which will load a properties file from its init method, and setup the initial debug level suppose ERROR, this servlet also has a get method which will read the input from a html page which can be DEBUG and then setup the log4j level to debug you can make this servlet secured so can only be used by some users Ashish --- Jacob Kjome [EMAIL PROTECTED] wrote: At 06:42 PM 1/21/2005 -0500, you wrote: Also keep in mind that Log4J has a JMX API that lets you configure it on the fly from the web, remotely, ... http://logging.apache.org/log4j/docs/api/org/apache/log4j/jmx/package-summary.html Except that the JMX stuff has been removed from Log4j-1.3 because there was no one maintaining it... http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/jmx/?hideattic=0 There has been some interest on the list for documenting this stuff, so it may come back. More interest will make it even more likely to come back. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
Essentially you have written a servlet but packaged it as a JSP. Anytime it becomes a trivial effort to hand transform a JSP into a servlet usually means some refactoring is in order. Personally I do not mind java code in JSP's but only if its structured. I try not to rely on in-line java code - but I try to use methods or inner classes for most java coding in a JSP. By doing that - it becomes easier to rip the methods and inner classes from the JPS page and into an independent object. By doing this - I get rapid turnaround - but don't code myself in a hole for when new functionality might be needed that might overlap existing pages. -Tim Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - 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]
Re: What is it mean that Java code does not belong in well designed JSP pages?
That's a good point Tim... I have to admit I've only used methods a couple of times in JSPs, generally preferring all the code be inline (except where there would be a lot of duplication, then I tend to make utility classes). You make a good point though, I may start getting into that habit myself :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Tim Funk wrote: Essentially you have written a servlet but packaged it as a JSP. Anytime it becomes a trivial effort to hand transform a JSP into a servlet usually means some refactoring is in order. Personally I do not mind java code in JSP's but only if its structured. I try not to rely on in-line java code - but I try to use methods or inner classes for most java coding in a JSP. By doing that - it becomes easier to rip the methods and inner classes from the JPS page and into an independent object. By doing this - I get rapid turnaround - but don't code myself in a hole for when new functionality might be needed that might overlap existing pages. -Tim Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Wendy Smoak wrote: From: Tony LaPaso [EMAIL PROTECTED] You have some good points, Jake. Thank you for the response. If you happen to run across the statement from Craig M. regarding Struts I'd like to see it. http://struts.apache.org/faqs/kickstart.html#jar The struts.jar file MUST be in each webapp, and not in any common location. Disk space and memory are cheap, I'd rather each webapp be a self-contained entity than to have to bother with making sure each server has the right things in various places. Not to mention that if I want to play with a newer version of some library, I don't risk breaking existing apps by replacing the common version, nor confusing the class loader by having both the old and new versions on the classpath. One other note - Tomcat gives you a framework contract, a contract defined by JSP/Servlet specification. There is no mention of JSTL in it. Thus, it is unwise to make it shared, since it involves making the JSTL more internal than external, from Tomcat's point of view. The situation with JDBC drivers, for instance, is slightly different. For use with DataSource mechanism, you have to place JDBC driver in shared area. But, on the other hand, DataSource, although not a part of JSP/Servlet specification, is not exactly external to the whole story. I understand the desire behind the original idea. I build packages myself and that usually leads me to not placing one content in several places. How about placing the JARs someplace public, OUTSIDE Tomcat, and making symbolic links in the web application's area? Again, that WILL make the web application in question dependant on some JARs not present in the package. If you're prepared to make your own RPMs no big deal. So, are you? :-) Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Mark, When you cleaned out the caches (by deleting the work directory) were you able to move the standard.jar and jstl.jar to shared/lib and then be able to use JSTL? I did that -- I deleted the 'work' directory and then moved the JARs from common/lib to shared/lib and re-started TC. Now I have the exception below. Is the JSP compiler not looking using shared/lib classloader, I wonder? org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:411) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:118) org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316) org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java:147) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539) org.apache.jasper.compiler.Parser.parse(Parser.java:126) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220) org.apache.jasper.compiler.ParserController.parse(ParserController.java:101) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203) org.apache.jasper.compiler.Compiler.compile(Compiler.java:495) org.apache.jasper.comp! iler.Compiler.compile(Compiler.java:476) org.apache.jasper.compiler.Compiler.compile(Compiler.java:464) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)- Original Message -From: Mark Thomas [EMAIL PROTECTED]To: Tomcat Users List tomcat-user@jakarta.apache.orgSent: Sunday, January 23, 2005 9:21 AMSubject: Re: ?? Sharing the JSTL JARS and Classloading ?? Tony LaPaso wrote: Incidentally, in reading the Tomcat docs for Classloading, it seemsthat any classes in a web app's lib directory *should* be able to seeclasses in the shared/lib directory. Similarly, any classes inshared/lib *should* be able to see what's in common/lib. This works as you ! expect. I just tested it with a clean TC5 build fromCVS. That being sa id I noticed the following whilst I was testing which mayhelp: - I needed to clean out the work directory for my app between each test. - I needed to restart Tomcat for each test. If I didn't do both of the above then various caches (already loadedclasses, JSPs that have already been compiled, etc) all contributed to weirdresults. angry-rant The crappy, incomplete Tomcat documentation strikes again. One of the badthings about these open source projects is that since no one owns them noone has responsibility to work on anything except what they're interestedin. The result is often neglected, shoddy and incomplete documentation. /angry-rant You are as much of the Tomcat community as anyone else. If you knowsomewhere where the docs are wrong (which you must do to be able to callthem crappy and incomplete - and by implication neglected and shoddy) whynot redirect your energy from futile ranting into creating patches toimprove the documentation and contribute t! o the community. So, again, it seems weird that putting the JSTL JARs in common/libworks fine while putting them in shared/lib doesn't. When I put them inshared/lib I get the exception shown below. From the exception below itseems to me that the classes in common/lib (e.g.,javax.servlet.http.HttpServlet) do not have access to classes inshared/lib (e.g., org.apache.taglibs.standard.tag.rt.core.ForEachTag)although the classes in common/lib *DO* obviously have access to classesin a web app's lib directory. If only the classloader docs were better In terms of the hierarchy, the docs are right. Perhaps what needs to beadded is the circumstances where restarts (app or tomcat) are required forchanges to take effect. For the record, my own view is that the increased effort required tomanage shared jars is rarely worth the disk space and memory it saves. Mark - To unsubscribe, e-mai! l: [EMAIL PROTECTED] For additional commands , e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
Don't ask to see my code. All I know is it works most of the time. Really, I think it is a matter of circumstance. Each case is different and allows for sway from one extreme to the other. One word of caution to people just learning, is that as you move from company to company expect to see a wide variety of philosophy about how something is done. So it is wise to understand each approach and it's pros and cons. I work for myself and I am still trying to understand the approach here. So what you will most likely find is that people will take the most direct path that the environment and knowledge will allow. Of course there are always the exceptions. Dola don't get too tied up in proper approaches as much as understanding the whys and why not to do it that way. As you code things you will always see a different or better way after you are almost done. Doug - Original Message - From: Frank W. Zammetti [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 1:22 PM Subject: Re: What is it mean that Java code does not belong in well designed JSP pages? That's a good point Tim... I have to admit I've only used methods a couple of times in JSPs, generally preferring all the code be inline (except where there would be a lot of duplication, then I tend to make utility classes). You make a good point though, I may start getting into that habit myself :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Tim Funk wrote: Essentially you have written a servlet but packaged it as a JSP. Anytime it becomes a trivial effort to hand transform a JSP into a servlet usually means some refactoring is in order. Personally I do not mind java code in JSP's but only if its structured. I try not to rely on in-line java code - but I try to use methods or inner classes for most java coding in a JSP. By doing that - it becomes easier to rip the methods and inner classes from the JPS page and into an independent object. By doing this - I get rapid turnaround - but don't code myself in a hole for when new functionality might be needed that might overlap existing pages. -Tim Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - 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] - 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]
Re: What is it mean that Java code does not belong in well designed JSP pages?
There are lots of reasons why this is not the way to code JSPs, Dola. Let's start with one: REUSABILITY. If I can read between the lines in your code, you are essentially using these classes to write HTML in sort of a Tiles way. This is clearly a good thing and your ideas might be really worthwhile. That is not at issue in what I have to say. I am also not, at the moment, talking about the %= whatever % expression code, but rather only the % whatever % scriptlet code. You don't use %! whatever %. declaration code. The only way to reuse the code you wrote is to copy and paste. (Often this is called cut and paste which makes no sense.) If you consolidated and generalized the code off the page in some, say, Process class, then you could have something like %= Process().process([whatever]) % where whatever represents what is peculiar to this page alone and what is common to all like pages is included in the off-JSP-page Process process method code. If you only made this change, then your page person, which might be the same person, would only have to write %= Process.process([whatever]) % on each page and would not have to write the code elsewhere either because that would already have been abstracted and done. If we cannot all agree this is progress, then we probably cannot agree on the whole idea of getting code off the page at all. I also like what Tim had to say because he recognizes that sometimes we have to write the particular code and abstract later as a business decision. However, he does it in a way that recognizes that adhering as close to the principles of OOP as possible will make the later transition easy when duplicating code becomes an issue. I hope this helps. Let me say that I find that the principles of OOP can be defended and need not be adhered to out of blind faith. It is better to find out what is up than to just follow the dictates of whomever. Once again, good question. I hope this engenders a long and useful thread. If it did, we could save a lot of ink on the list. Jack On Sun, 23 Jan 2005 07:07:21 -0800 (PST), Dola Woolfe [EMAIL PROTECTED] wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
Thank you for the useful responses. I agree with the person (sorry, tough to both type and look up names...) who said that I wrote enough code for it to be a servlet. In fact, I would rather write a servlet! This is because I prefer to work with JBuilder and JBuilder does an OK job aligning and code completing .java files (about 80% of what Emacs' performance) and an outright lousy working with .jsp pages. But there are such tremendous barriers to entry with a servlet. You need (or maybe things got better) to modify web.xml and restart the app. Then every time the code changes, the app needs to be restarted. The project I work with takes 2 min to start up so this is prohibitive. Sometimes for development purposes I dumb it down so it takes 10 sec to start up but it is still a pain. Am I saying anything that indicates that I'm doing things wrong? The one thing that I can't imagine being the right thing to do (for me) is writing html code. Just switching 2 rows in a table is enough to send me into a panic. And you don't find out that you made a mistake until you view the page. That's why I use an html library with classes like Table, Page, Body, Form.Button, Anchor, etc. Again any comments? I truly enjoy reading the dicussion that I started. --- Parsons Technical Services [EMAIL PROTECTED] wrote: Don't ask to see my code. All I know is it works most of the time. Really, I think it is a matter of circumstance. Each case is different and allows for sway from one extreme to the other. One word of caution to people just learning, is that as you move from company to company expect to see a wide variety of philosophy about how something is done. So it is wise to understand each approach and it's pros and cons. I work for myself and I am still trying to understand the approach here. So what you will most likely find is that people will take the most direct path that the environment and knowledge will allow. Of course there are always the exceptions. Dola don't get too tied up in proper approaches as much as understanding the whys and why not to do it that way. As you code things you will always see a different or better way after you are almost done. Doug - Original Message - From: Frank W. Zammetti [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 1:22 PM Subject: Re: What is it mean that Java code does not belong in well designed JSP pages? That's a good point Tim... I have to admit I've only used methods a couple of times in JSPs, generally preferring all the code be inline (except where there would be a lot of duplication, then I tend to make utility classes). You make a good point though, I may start getting into that habit myself :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Tim Funk wrote: Essentially you have written a servlet but packaged it as a JSP. Anytime it becomes a trivial effort to hand transform a JSP into a servlet usually means some refactoring is in order. Personally I do not mind java code in JSP's but only if its structured. I try not to rely on in-line java code - but I try to use methods or inner classes for most java coding in a JSP. By doing that - it becomes easier to rip the methods and inner classes from the JPS page and into an independent object. By doing this - I get rapid turnaround - but don't code myself in a hole for when new functionality might be needed that might overlap existing pages. -Tim Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - 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]
Re: What is it mean that Java code does not belong in well designed JSP pages?
On the subject of your hope that this engenders a long can the English be fixed in the subject before this is archived? It's embarrassing. --- Dakota Jack [EMAIL PROTECTED] wrote: There are lots of reasons why this is not the way to code JSPs, Dola. Let's start with one: REUSABILITY. If I can read between the lines in your code, you are essentially using these classes to write HTML in sort of a Tiles way. This is clearly a good thing and your ideas might be really worthwhile. That is not at issue in what I have to say. I am also not, at the moment, talking about the %= whatever % expression code, but rather only the % whatever % scriptlet code. You don't use %! whatever %. declaration code. The only way to reuse the code you wrote is to copy and paste. (Often this is called cut and paste which makes no sense.) If you consolidated and generalized the code off the page in some, say, Process class, then you could have something like %= Process().process([whatever]) % where whatever represents what is peculiar to this page alone and what is common to all like pages is included in the off-JSP-page Process process method code. If you only made this change, then your page person, which might be the same person, would only have to write %= Process.process([whatever]) % on each page and would not have to write the code elsewhere either because that would already have been abstracted and done. If we cannot all agree this is progress, then we probably cannot agree on the whole idea of getting code off the page at all. I also like what Tim had to say because he recognizes that sometimes we have to write the particular code and abstract later as a business decision. However, he does it in a way that recognizes that adhering as close to the principles of OOP as possible will make the later transition easy when duplicating code becomes an issue. I hope this helps. Let me say that I find that the principles of OOP can be defended and need not be adhered to out of blind faith. It is better to find out what is up than to just follow the dictates of whomever. Once again, good question. I hope this engenders a long and useful thread. If it did, we could save a lot of ink on the list. Jack On Sun, 23 Jan 2005 07:07:21 -0800 (PST), Dola Woolfe [EMAIL PROTECTED] wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong. Schematically, my typical JSP page looks like the following (basically 100% code). Is this what Craig is advising against? %@ page errorPage=ErrorPage.jsp import=html.*% [EMAIL PROTECTED] file=InitializePage.jsp% % Table table = new Table() .pAddH(#).pAddH(Action).pLN() .pAddC(1).pAddL(new Anchor(HelloPage.jsp, Say hello to my friend.)).pLN() .pAddC(2).pAddL(new Anchor(GoodByePage.jsp, Say good bye to my friend)).pLN() ; MyTemplate template = new MyTemplate (Main Actions, table); Page pAgE = new Page(new MyHead(Data Tools), new Body(template)); % %= pAgE % __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
I'm quite late to this thread, so I'll stick to answering the one technical question: On Sun, Jan 23, 2005 at 12:03:36PM -0800, Dola Woolfe wrote: : the code changes, the app needs to be restarted. The : project I work with takes 2 min to start up so this is : prohibitive There's a reloadable attr on the Tomcat config's Context tag. Set this to true while you're in development mode to make the container periodically check for changes in WEB-INF/classes and reload accordingly. It may also check under WEB-INF/lib, I don't recall... : Sometimes for development purposes I dumb : it down so it takes 10 sec to start up but it is still : a pain. Am I saying anything that indicates that I'm : .doing things wrong? Wrong is too strong a term here; but some would argue that you may not have to tweak the servlets so much if you were to formally separate calls to business logic (servlets, which require a container restart) and formatting/presentation (JSPs, which are automatically rebuilt when changed). In my experience, the servlet layer is pretty thin and simple; it's getting the final content *just right* that can require several edits to a file. I don't mean for this to sound flippant. A lot of the good ideas and best practices are based on starting an app from scratch. When you're migrating an existing app -- and in your case, across two servlet spec revisions -- it can be tough. You sometimes have to decide whether it's worth a hefty refactoring effort or starting over from scratch. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
- Original Message - From: Nikola Milutinovic [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 12:32 PM Subject: Re: ?? Sharing the JSTL JARS and Classloading ?? One other note - Tomcat gives you a framework contract, a contract defined by JSP/Servlet specification. There is no mention of JSTL in it. Thus, it is unwise to make it shared, since it involves making the JSTL more internal than external, from Tomcat's point of view. Nic, You are right: Tomcat provides a contract via it's implementation of the Servlet/JSP spec and the JSTL has absolutely nothing to do with it. Tomcat *also*, however, provides an alleged facilty (shared/lib) for the sharing of JAR file across web applications. This capability is independent of the Servlet/JSP specs but it is supposed to work with Tomcat. There's a more important issue at work here than whether or not I have to put the JARs in common/lib or shared/lib: When writing code it's considered a bad practice (and I think, rightfully so) to copy and paste the same code to various locations. Instead, we factor out common behavior into separate classes or methods. There's an analogous idea involved here -- instead of copying and pasting the same JARs across many web applications it makes more sense (to me, anyway), to factor out these JARs and make them centrally available. Having said that, I also realize the code within the JARs must be written such that the classes can be shared. Think of .so files or .DLL files. With .DLL files, for example, Windows will share the library's contents across several processes rather than load the same DLL each time for every process. I think this is a good strategy, again, assuming the classes in the JAR were written so as to be shared. It's not a matter of disk or memory space, per se, it's more a matter of administrative convenience. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Tony LaPaso wrote: There's a more important issue at work here than whether or not I have to put the JARs in common/lib or shared/lib: When writing code it's considered a bad practice (and I think, rightfully so) to copy and paste the same code to various locations. Instead, we factor out common behavior into separate classes or methods. There's an analogous idea involved here -- instead of copying and pasting the same JARs across many web applications it makes more sense (to me, anyway), to factor out these JARs and make them centrally available. Having said that, I also realize the code within the JARs must be written such that the classes can be shared. The flip side of that of course is that you'll potentially run into the same problem as Windows: DLL Hell, although it'll be JAR Hell now :) The point about administrative simplicity is well-taken, but I've always been of the mindset that I'd rather have the JARs repeated in each webapp because then if I have to change a JAR version for a particular app I don't have to go and make sure all the other apps work with that version too. Same problem with DLLs... how many times have you had a version conflict with MS Common Controls? Maybe not recently because some work has been done to alleviate this situation, but certainly in the past is arose all the time. The same could happen if you make JARs shared across webapps. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is it mean that Java code does not belong in well designed JSP pages?
I work in a shop similar to the one you describe where individuals are forced to fill multiple roles. I'm called upon to implement everything from domain models to navigation menus. However, I find that keeping the Java code that appears in JSP to a minimum helps in this situation as well. Although I am completely capable of wearing multiple hats, I do feel that we all benefit from practices that limit the amount of time we have to wear all those hats at once. I would also argue the quality of our work benefits from the increased level of focus such discipline provides. Some logic does belong in JSP. However, the logic that appears within pages should be limited to display logic. I've found that Struts and JSTL are a great combination to accomplish such separation. -Sean On Sun, 2005-01-23 at 10:45 -0500, Frank W. Zammetti wrote: I certainly wouldn't presume to speak for Craig, so this is just my own answer... Scriplets, that is, code in JSPs inside % %, is generally considered a Bad Thing(tm) because it's too easy for business logic to sneak into the presentation. Now, there is I think room for debate about how far to push that idea. Some people think that a JSP should be absolutely nothing more than a template for display, so you should wind up with nothing but things like $=someVar%, or more correctly, something like bean:write name=myBean property=myVar /. However, where there is room for debate is whether using any sort of logic whatsoever in a JSP is bad or not. Taking the JSP as a template only idea to it's fullest extent seems to me to imply that logic in ANY form is to be avoided, and should not be done in a JSP, whether it's using taglibs or not to do it (i.e., logic:equal/ shouldn't even be used because it's logic). I think this is too extreme and limits the types of applications you can do... try doing the kinds of apps I do for a living for example, which are webapps that look, feel and work like fat clients, and you'll be hard-pressed to pull off the kinds of things I do without some level of logic in JSPs. That being said, good design dictates that you need to be careful what gets put in your JSPs, whether you use custom tags or not (I'm not a fan of custom tags myself in most cases). Business logic does NOT belong in JSPs, and indeed anything other than trivial bits of code probably shouldn't be there either. I'm not entirely sure what the code you posted is doing, but my gut feeling is that it's too much for a JSP. I do things like this all the time; % boolean altRow = false; String rowStyle = ; for (Iterator it = form.getTOAList().iterator(); it.hasNext(); ) { if (altRow) { rowStyle = cssListboxAltRow; altRow = false; } else { rowStyle = ; altRow = true; } HashMap nextItem = (HashMap)it.next(); BigDecimal toaID = (BigDecimal)nextItem.get(toaID); String status = (String)nextItem.get(status); % tr height=24 class=%=rowStyle% td%=status%/td td%=toaID%/td /tr % } % ...and some will say that's way too much... let's skip the this should be a custom tag! argument for the time being... This kind of code I see no problem with being in a JSP. It's strictly presentation-oriented, and isn't extensive. That being said, NOW we can get to the this shouldn't be there at all argument... it is a perfectly reasonable argument. In an environment where you have page authors and Java coders, you don't want your page authors to have to see code like that. In fact, in the perfect environment where it's split exactly right, they wouldn't even know what this code meant. But, if you had a custom tag that encapsulated that functionality, they could just put showTOAList/ and be done with it. That's the argument for taglibs (the main one anyway). However, you have to ask yourself what kind of environment your in... I dare say most environments are NOT set up that way... maybe they should be, but I don't think the majority are... most places, your page authors are your Java coders are your database developers are your business analysts, etc. In that case, I think the argument doesn't carry as much weight. Eh, I guess I'm off on a bit of a tangent. Most people will tell you that code in JSPs is to be avoided, and I'm not going out of my way to debate that. But, I think it's fair to say that if you do have code in JSPs, it should be (a) trivial and (b) strictly presentation-related. Breaking THOSE rules, which by extension breaks the higher rules, is to be avoided at all costs. Just my opinions. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Dola Woolfe wrote: I just read this thread and didn't quite understand it. If it means what it seems to mean on the surface, I'm doing everything wrong.
Re: What is it mean that Java code does not belong in well designed JSP pages?
provides. Some logic does belong in JSP. However, the logic that appears within pages should be limited to display logic. I've found that Struts and JSTL are a great combination to accomplish such separation. IMHO this is basically the essence of Java code does no belong in well designed JSP pages Keep the MVC separation in order not to clutter your view (e.g. JSP) with business logic. That can be achieved with various frameworks like Struts. Whenever you need code, think of Struts Taglibs or JSTL first. Usually this is sufficient for all the legal code in JSPs. That is display logic like reformating values for displayment that were calculated in your business logic elsewhere. E.g. iteration over lists, colorize things, whatever. This will reduce your JSP's Java code to snippets of just a few lines. Of course, with custom taglibs even that could be reduced to zero, but that's usually not worth the effort (if not reusable). Or don't use JSP at all (but if so, bundle with Struts)... Tapestry is also good to separate view and business logic, at least if you don't put to much OGNL in your html templates ;-) That's as worse as too much Java code and EL in JSPs. Cheers, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Tony LaPaso wrote: Mark, When you cleaned out the caches (by deleting the work directory) were you able to move the standard.jar and jstl.jar to shared/lib and then be able to use JSTL? Yes. I did that -- I deleted the 'work' directory and then moved the JARs from common/lib to shared/lib and re-started TC. Now I have the exception below. Is the JSP compiler not looking using shared/lib classloader, I wonder? It is working for me (but I am using the latest CVS code for 5.5.x). Maybe a configuration problem? Not sure what could cause this though. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Mark Thomas wrote: Tony LaPaso wrote: Mark, When you cleaned out the caches (by deleting the work directory) were you able to move the standard.jar and jstl.jar to shared/lib and then be able to use JSTL? Yes. I did that -- I deleted the 'work' directory and then moved the JARs from common/lib to shared/lib and re-started TC. Now I have the exception below. Is the JSP compiler not looking using shared/lib classloader, I wonder? It is working for me (but I am using the latest CVS code for 5.5.x). Maybe a configuration problem? Not sure what could cause this though. Just to be 100% sure I built 5.0.30 from CVS and ran my very simple test case. The test case passed. This now looks very much like a configuration problem, although I still don't have a clue what would cause the behaviour you are seeing. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Syntax error on toekn import
Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Syntax error on toekn import
Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Re: What is it mean that Java code does not belong in well designed JSP pages?
snip On Sun, 23 Jan 2005 12:09:39 -0800 (PST), Dola Woolfe [EMAIL PROTECTED] wrote: On the subject of your hope that this engenders a long can the English be fixed in the subject before this is archived? It's embarrassing. /snip Too late. Don't worry about it. What we type in here rarely has much to do with our real understanding of English. I don't bother to change a lot and assume the regular corrections for others as well. Jack -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Syntax error on toekn import
DOH.. PLEASE ignore that second line. And to clarify the first line is doing two imports. java.util.* and ddr.* Doug - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 6:41 PM Subject: Re: Syntax error on toekn import Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Syntax error on toekn import
...Thanks, but how do I know what file the problem occurs in. It doesn't tell me what it fails to compile. From the browser's point of view everything works correctly. Also, I'm note quite sure about the colons and semicolons. I think I use neither, I use a comma. Dola --- Parsons Technical Services [EMAIL PROTECTED] wrote: DOH.. PLEASE ignore that second line. And to clarify the first line is doing two imports. java.util.* and ddr.* Doug - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 6:41 PM Subject: Re: Syntax error on toekn import Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help with JDBC query
I'm getting the following error in an insert, the update works fine. Is there a way to get a more informative error message about the error? Does anyone see a syntax error that I missed? I'm using MySQL 4.1.8 and Connector/J 3.0.16. 19:13:20,906 INFO [STDOUT] -SQLException- 19:13:20,906 INFO [STDOUT] SQLState: 42000 19:13:20,921 INFO [STDOUT] Message: Syntax error or access violation message from server: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 19:13:20,921 INFO [STDOUT] Vendor: 1064 19:13:20,937 INFO [STDOUT] descriptiveCopy: sql.setSqlValue(INSERT INTO Restaurant + (Name, Cuisine, ChefsName, Address_1, Address_2, + Neighborhood, City, State, ZIP, Country, + OfficePhone, ReservationPhone, FaxPhone, Email, Web, + HandicappAccess, CreditCards, CostBreakfast, CostLunch, CostDinner, + DressCode, Reservations, NonSmoking, OffStreetParking, OutsideDining, + Banquet, BanquetCapacity, Catering, ServiceTypes, DeliveryService, + LowCarbMenu, ChildMenu, ServesBooze, Entertainment, PhotoURL, + ImageCredit, LogoURL, DescriptiveCopy, AtAGlance, NearBy, + RestaurantOrder, Subscriber, SubscriptionExpired, UserID) + VALUES(?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?); } else { // Update an existing restaurant sql.setSqlValue(UPDATE Restaurant SET + Name = ?, Cuisine = ?, + ChefsName = ?, Address_1 = ?, Address_2 = ?, Neighborhood = ?, City = ?, + State = ?, ZIP = ?, Country = ?, OfficePhone = ?, ReservationPhone = ?, + FaxPhone = ?, Email = ?, Web = ?, HandicappAccess = ?, CreditCards = ?, + CostBreakfast = ?, CostLunch = ?, CostDinner = ?, DressCode = ?, Reservations = ?, + NonSmoking = ?, OffStreetParking = ?, OutsideDining = ?, Banquet = ?, BanquetCapacity = ?, + Catering = ?, ServiceTypes = ?, DeliveryService = ?, LowCarbMenu = ?, ChildMenu = ?, + ServesBooze = ?, Entertainment = ?, PhotoURL = ?, ImageCredit = ?, LogoURL = ?, + DescriptiveCopy = ?, AtAGlance = ?, NearBy = ? + WHERE RestaurantID = ?); } List values = new ArrayList(); values.add(request.getParameter(name)); values.add(request.getParameter(cuisine)); values.add(request.getParameter(chef)); values.add(request.getParameter(address1)); values.add(request.getParameter(address2)); values.add(request.getParameter(neighborhood)); values.add(request.getParameter(city)); values.add(request.getParameter(state)); values.add(request.getParameter(zip)); values.add(request.getParameter(country)); values.add(request.getParameter(officePhone)); values.add(request.getParameter(reservationPhone)); values.add(request.getParameter(fax)); values.add(request.getParameter(email)); values.add(request.getParameter(web)); int access = 0; String param = request.getParameter(access); if(param != null param.equals(on)){ access = 1; } values.add( + access); /** * visa = 1, mc = 2, amex = 4, discover = 8, diners = 16 * other usable id's are: 32, 64 and 128 * * This may have to be changed to accomodate Java 5.0 enum */ int cc = 0; param = request.getParameter(visa); if(param != null param.equals(on)){ cc |= 1; } param = request.getParameter(mastercard); if(param != null param.equals(on)){ cc |= 2; } param = request.getParameter(americanExpress); if(param != null param.equals(on)){ cc |= 4; } param = request.getParameter(discover); if(param != null param.equals(on)){ cc |= 8; } param = request.getParameter(diners); if(param != null param.equals(on)){ cc |= 16; } values.add( + cc); values.add(request.getParameter(costBreakfast)); values.add(request.getParameter(costLunch)); values.add(request.getParameter(costDinner)); values.add(request.getParameter(dressCode)); values.add(request.getParameter(reservations)); int nonSmoking = 0; param = request.getParameter(nonSmoking); if(param != null param.equals(on)){ nonSmoking = 1; } values.add( + nonSmoking); int offStreetParking = 0; param = request.getParameter(offStreetParking); if(param != null param.equals(on)){ offStreetParking = 1; } values.add( + offStreetParking); int outsideDining = 0; param = request.getParameter(outsideDining); if(param != null param.equals(on)){ outsideDining = 1; } values.add( + outsideDining); int banquet = 0; param = request.getParameter(banquet); if(param != null param.equals(on)){ banquet = 1; } values.add( + banquet); values.add(request.getParameter(banquetCapacity)); int catering = 0; param = request.getParameter(catering); if(param != null param.equals(on)){ catering = 1; } values.add( + catering); values.add(request.getParameter(serviceTypes)); int deliveryService = 0; param = request.getParameter(deliveryService); if(param != null param.equals(on)){ deliveryService = 1; } values.add( + deliveryService); int
Re: Help with JDBC query
I think you put the ) after the end of sql expression. It is not going to make it into a parsed query. One more suggestion - put these fields one per line - it is going to be too hard to debug them this way - they are all on the same line. Best regards, Edmon Begoli Jack Lauman wrote: I'm getting the following error in an insert, the update works fine. Is there a way to get a more informative error message about the error? Does anyone see a syntax error that I missed? I'm using MySQL 4.1.8 and Connector/J 3.0.16. 19:13:20,906 INFO [STDOUT] -SQLException- 19:13:20,906 INFO [STDOUT] SQLState: 42000 19:13:20,921 INFO [STDOUT] Message: Syntax error or access violation message from server: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 19:13:20,921 INFO [STDOUT] Vendor: 1064 19:13:20,937 INFO [STDOUT] descriptiveCopy: sql.setSqlValue(INSERT INTO Restaurant + (Name, Cuisine, ChefsName, Address_1, Address_2, + Neighborhood, City, State, ZIP, Country, + OfficePhone, ReservationPhone, FaxPhone, Email, Web, + HandicappAccess, CreditCards, CostBreakfast, CostLunch, CostDinner, + DressCode, Reservations, NonSmoking, OffStreetParking, OutsideDining, + Banquet, BanquetCapacity, Catering, ServiceTypes, DeliveryService, + LowCarbMenu, ChildMenu, ServesBooze, Entertainment, PhotoURL, + ImageCredit, LogoURL, DescriptiveCopy, AtAGlance, NearBy, + RestaurantOrder, Subscriber, SubscriptionExpired, UserID) + VALUES(?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?); } else { // Update an existing restaurant sql.setSqlValue(UPDATE Restaurant SET + Name = ?, Cuisine = ?, + ChefsName = ?, Address_1 = ?, Address_2 = ?, Neighborhood = ?, City = ?, + State = ?, ZIP = ?, Country = ?, OfficePhone = ?, ReservationPhone = ?, + FaxPhone = ?, Email = ?, Web = ?, HandicappAccess = ?, CreditCards = ?, + CostBreakfast = ?, CostLunch = ?, CostDinner = ?, DressCode = ?, Reservations = ?, + NonSmoking = ?, OffStreetParking = ?, OutsideDining = ?, Banquet = ?, BanquetCapacity = ?, + Catering = ?, ServiceTypes = ?, DeliveryService = ?, LowCarbMenu = ?, ChildMenu = ?, + ServesBooze = ?, Entertainment = ?, PhotoURL = ?, ImageCredit = ?, LogoURL = ?, + DescriptiveCopy = ?, AtAGlance = ?, NearBy = ? + WHERE RestaurantID = ?); } List values = new ArrayList(); values.add(request.getParameter(name)); values.add(request.getParameter(cuisine)); values.add(request.getParameter(chef)); values.add(request.getParameter(address1)); values.add(request.getParameter(address2)); values.add(request.getParameter(neighborhood)); values.add(request.getParameter(city)); values.add(request.getParameter(state)); values.add(request.getParameter(zip)); values.add(request.getParameter(country)); values.add(request.getParameter(officePhone)); values.add(request.getParameter(reservationPhone)); values.add(request.getParameter(fax)); values.add(request.getParameter(email)); values.add(request.getParameter(web)); int access = 0; String param = request.getParameter(access); if(param != null param.equals(on)){ access = 1; } values.add( + access); /** * visa = 1, mc = 2, amex = 4, discover = 8, diners = 16 * other usable id's are: 32, 64 and 128 * * This may have to be changed to accomodate Java 5.0 enum */ int cc = 0; param = request.getParameter(visa); if(param != null param.equals(on)){ cc |= 1; } param = request.getParameter(mastercard); if(param != null param.equals(on)){ cc |= 2; } param = request.getParameter(americanExpress); if(param != null param.equals(on)){ cc |= 4; } param = request.getParameter(discover); if(param != null param.equals(on)){ cc |= 8; } param = request.getParameter(diners); if(param != null param.equals(on)){ cc |= 16; } values.add( + cc); values.add(request.getParameter(costBreakfast)); values.add(request.getParameter(costLunch)); values.add(request.getParameter(costDinner)); values.add(request.getParameter(dressCode)); values.add(request.getParameter(reservations)); int nonSmoking = 0; param = request.getParameter(nonSmoking); if(param != null param.equals(on)){ nonSmoking = 1; } values.add( + nonSmoking); int offStreetParking = 0; param = request.getParameter(offStreetParking); if(param != null param.equals(on)){ offStreetParking = 1; } values.add( + offStreetParking); int outsideDining = 0; param = request.getParameter(outsideDining); if(param != null param.equals(on)){ outsideDining = 1; } values.add( + outsideDining); int banquet = 0; param = request.getParameter(banquet); if(param != null param.equals(on)){ banquet = 1; } values.add( + banquet); values.add(request.getParameter(banquetCapacity)); int catering = 0; param = request.getParameter(catering); if(param != null
Re: Syntax error on toekn import
Dolla, It looks like a Java syntax error in your import. BTW, You'll get better help for your jsp coding issues at the Sun's Servlet/JSP mailing list. Thank you, Edmon Dola Woolfe wrote: ...Thanks, but how do I know what file the problem occurs in. It doesn't tell me what it fails to compile. From the browser's point of view everything works correctly. Also, I'm note quite sure about the colons and semicolons. I think I use neither, I use a comma. Dola --- Parsons Technical Services [EMAIL PROTECTED] wrote: DOH.. PLEASE ignore that second line. And to clarify the first line is doing two imports. java.util.* and ddr.* Doug - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 6:41 PM Subject: Re: Syntax error on toekn import Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Re: Syntax error on toekn import
Post the stack trace. Also follow it all the way down. Sometimes there is a second segment named root cause. Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 8:42 PM Subject: Re: Syntax error on toekn import ...Thanks, but how do I know what file the problem occurs in. It doesn't tell me what it fails to compile. From the browser's point of view everything works correctly. Also, I'm note quite sure about the colons and semicolons. I think I use neither, I use a comma. Dola --- Parsons Technical Services [EMAIL PROTECTED] wrote: DOH.. PLEASE ignore that second line. And to clarify the first line is doing two imports. java.util.* and ddr.* Doug - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 6:41 PM Subject: Re: Syntax error on toekn import Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Re: Help with JDBC query
Actually you need to add a ) at the end: ?, ?, ?, ?)); Classic case of unmatched bracket. Inner one is for the sql string as per Edmon and outer for your method call sql.setSqlValue( ); Doug - Original Message - From: Edmon Begoli [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 10:36 PM Subject: Re: Help with JDBC query I think you put the ) after the end of sql expression. It is not going to make it into a parsed query. One more suggestion - put these fields one per line - it is going to be too hard to debug them this way - they are all on the same line. Best regards, Edmon Begoli Jack Lauman wrote: I'm getting the following error in an insert, the update works fine. Is there a way to get a more informative error message about the error? Does anyone see a syntax error that I missed? I'm using MySQL 4.1.8 and Connector/J 3.0.16. 19:13:20,906 INFO [STDOUT] -SQLException- 19:13:20,906 INFO [STDOUT] SQLState: 42000 19:13:20,921 INFO [STDOUT] Message: Syntax error or access violation message from server: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 19:13:20,921 INFO [STDOUT] Vendor: 1064 19:13:20,937 INFO [STDOUT] descriptiveCopy: sql.setSqlValue(INSERT INTO Restaurant + (Name, Cuisine, ChefsName, Address_1, Address_2, + Neighborhood, City, State, ZIP, Country, + OfficePhone, ReservationPhone, FaxPhone, Email, Web, + HandicappAccess, CreditCards, CostBreakfast, CostLunch, CostDinner, + DressCode, Reservations, NonSmoking, OffStreetParking, OutsideDining, + Banquet, BanquetCapacity, Catering, ServiceTypes, DeliveryService, + LowCarbMenu, ChildMenu, ServesBooze, Entertainment, PhotoURL, + ImageCredit, LogoURL, DescriptiveCopy, AtAGlance, NearBy, + RestaurantOrder, Subscriber, SubscriptionExpired, UserID) + VALUES(?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, + ?, ?, ?, ?); } else { // Update an existing restaurant sql.setSqlValue(UPDATE Restaurant SET + Name = ?, Cuisine = ?, + ChefsName = ?, Address_1 = ?, Address_2 = ?, Neighborhood = ?, City = ?, + State = ?, ZIP = ?, Country = ?, OfficePhone = ?, ReservationPhone = ?, + FaxPhone = ?, Email = ?, Web = ?, HandicappAccess = ?, CreditCards = ?, + CostBreakfast = ?, CostLunch = ?, CostDinner = ?, DressCode = ?, Reservations = ?, + NonSmoking = ?, OffStreetParking = ?, OutsideDining = ?, Banquet = ?, BanquetCapacity = ?, + Catering = ?, ServiceTypes = ?, DeliveryService = ?, LowCarbMenu = ?, ChildMenu = ?, + ServesBooze = ?, Entertainment = ?, PhotoURL = ?, ImageCredit = ?, LogoURL = ?, + DescriptiveCopy = ?, AtAGlance = ?, NearBy = ? + WHERE RestaurantID = ?); } List values = new ArrayList(); values.add(request.getParameter(name)); values.add(request.getParameter(cuisine)); values.add(request.getParameter(chef)); values.add(request.getParameter(address1)); values.add(request.getParameter(address2)); values.add(request.getParameter(neighborhood)); values.add(request.getParameter(city)); values.add(request.getParameter(state)); values.add(request.getParameter(zip)); values.add(request.getParameter(country)); values.add(request.getParameter(officePhone)); values.add(request.getParameter(reservationPhone)); values.add(request.getParameter(fax)); values.add(request.getParameter(email)); values.add(request.getParameter(web)); int access = 0; String param = request.getParameter(access); if(param != null param.equals(on)){ access = 1; } values.add( + access); /** * visa = 1, mc = 2, amex = 4, discover = 8, diners = 16 * other usable id's are: 32, 64 and 128 * * This may have to be changed to accomodate Java 5.0 enum */ int cc = 0; param = request.getParameter(visa); if(param != null param.equals(on)){ cc |= 1; } param = request.getParameter(mastercard); if(param != null param.equals(on)){ cc |= 2; } param = request.getParameter(americanExpress); if(param != null param.equals(on)){ cc |= 4; } param = request.getParameter(discover); if(param != null param.equals(on)){ cc |= 8; } param = request.getParameter(diners); if(param != null param.equals(on)){ cc |= 16; } values.add( + cc); values.add(request.getParameter(costBreakfast)); values.add(request.getParameter(costLunch)); values.add(request.getParameter(costDinner)); values.add(request.getParameter(dressCode)); values.add(request.getParameter(reservations)); int nonSmoking = 0; param = request.getParameter(nonSmoking); if(param != null param.equals(on)){ nonSmoking = 1; } values.add( + nonSmoking); int offStreetParking = 0; param = request.getParameter(offStreetParking); if(param != null param.equals(on)){ offStreetParking = 1; } values.add( + offStreetParking); int outsideDining = 0; param =
more graphs
I managed to spend some time this weekend graphing up the results. I still have to add the results from Tim and write up a summary. http://cvs.apache.org/~woolfel/tc_results.html peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Syntax error on toekn import
Thank you for offering to look at the stack, but I've discovered the error. I has an import= statement in one jsp. Apparently that's illegal (worked ok in TC3.3). But just for kicks here's the entire stack trace. What I'm wondering is how I can identify the offending jsp. Generated servlet error: Syntax error on token import, Identifier expected after this token at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534) --- Parsons Technical Services [EMAIL PROTECTED] wrote: Post the stack trace. Also follow it all the way down. Sometimes there is a second segment named root cause. Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 8:42 PM Subject: Re: Syntax error on toekn import ...Thanks, but how do I know what file the problem occurs in. It doesn't tell me what it fails to compile. From the browser's point of view everything works correctly. Also, I'm note quite sure about the colons and semicolons. I think I use neither, I use a comma. Dola --- Parsons Technical Services [EMAIL PROTECTED] wrote: DOH.. PLEASE ignore that second line. And to clarify the first line is doing two imports. java.util.* and ddr.* Doug - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 6:41 PM Subject: Re: Syntax error on toekn import Post your code section where you are doing the imports. Missing semicolon or colon instead of semi. Incorrect syntax could actually be on the line before the import statement as well. %@ page import=java.util.*,ddr.* % %@ page import=java.sql.* % Doug - Original Message - From: Dola Woolfe [EMAIL PROTECTED] To: Tom Cat tomcat-user@jakarta.apache.org Sent: Sunday, January 23, 2005 5:44 PM Subject: Syntax error on toekn import Hi, Just switched to a certain extent to 5.5 (hero). I'm getting Sintax error on toekn import, Identifier exprected after this token. but the stack trace does not refer to any of my classes or jsp pages. Where can I start looking for this error? Dola __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED]