Re: Closing a ResultSet, was "Re: odd oracle error"
Your right William, If you study the example, the rs.close and stmt.close always get executed, just like a finally block always gets executed (except, of course if an exception crashes the block before it can get to it. Good code practice would say your right. This is the example from Resin's web site. Good eye though :-) T.K. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]] On Behalf Of William W. Nelson Sent: Monday, February 03, 2003 10:29 AM To: [EMAIL PROTECTED] Subject: Re: Closing a ResultSet, was "Re: odd oracle error" rs.close() and stmt.close() should be in the finally block. - I have had a problem too when closing the result set. I found this example on "Resin's" web site. It is not an Oracow database, but it may serve as an example. T.K. public void init() throws ServletException { try { Context env = (Context) new InitialContext().lookup("java:comp/env"); pool = (DataSource) env.lookup("jdbc/test"); if (pool == null) throw new ServletException("`jdbc/test' is an unknown DataSource"); } catch (NamingException e) { throw new ServletException(e); } } public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); Connection conn = null; try { conn = pool.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select NAME, PRICE from BROOMS"); out.println("Brooms:"); while (rs.next()) { out.print(rs.getString(1)); out.print(" "); out.print(rs.getInt(2)); out.println(""); } rs.close(); stmt.close(); } catch (SQLException e) { throw new ServletException(e); } finally { try { if (conn != null) conn.close(); } catch (SQLException e) { } } } === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
Re: Closing a ResultSet, was "Re: odd oracle error"
I have had a problem too when closing the result set. I found this example on "Resin's" web site. It is not an Oracow database, but it may serve as an example. T.K. public void init() throws ServletException { try { Context env = (Context) new InitialContext().lookup("java:comp/env"); pool = (DataSource) env.lookup("jdbc/test"); if (pool == null) throw new ServletException("`jdbc/test' is an unknown DataSource"); } catch (NamingException e) { throw new ServletException(e); } } public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); Connection conn = null; try { conn = pool.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select NAME, PRICE from BROOMS"); out.println("Brooms:"); while (rs.next()) { out.print(rs.getString(1)); out.print(" "); out.print(rs.getInt(2)); out.println(""); } rs.close(); stmt.close(); } catch (SQLException e) { throw new ServletException(e); } finally { try { if (conn != null) conn.close(); } catch (SQLException e) { } } } } === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
Re: Logging with Linux
THANKS FOR THE REPLIES! The "tail -f catalina.out" (catalina.out instead of stdout.txt for Tomcat) is just what I was looking for. TK -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Luis Cornide Arce Sent: Friday, December 13, 2002 7:11 AM To: [EMAIL PROTECTED] Subject: Re: Logging with Linux Have you look in the file $TOMCAT_HOME/logs/catalina.out? Regards, Luis Zerbe John W wrote: >I don't use Tomcat, but I do use WebSphere. The application servers write to a configured stdout.txt file in the linux file system. To watch the output in real time, you can use a linux command like "tail -f stdout.txt" from an xterm window. > >-----Original Message- >From: Tom Kochanowicz [mailto:[EMAIL PROTECTED]] >Sent: Friday, December 13, 2002 2:20 AM >To: [EMAIL PROTECTED] >Subject: Logging with Linux > > >I am doing develoment under the Linux/Tomcat platform. I like Linux except >I miss the DOS window in windows for debugging using System.out.println("It >works for me"); I have looked into Log4j but I do not like looking at the >logging.properties files for my errors, I want them to show right away. I am >using jdk 1.4.x and I know about the logging API, but I want something like >the System.out.() ... for Linux Any suggestions?? > >T.K. > >=== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > > >DISCLAIMER: >The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator. > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > > > > === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Logging with Linux
I am doing develoment under the Linux/Tomcat platform. I like Linux except I miss the DOS window in windows for debugging using System.out.println("It works for me"); I have looked into Log4j but I do not like looking at the logging.properties files for my errors, I want them to show right away. I am using jdk 1.4.x and I know about the logging API, but I want something like the System.out.() ... for Linux Any suggestions?? T.K. === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: caching images
Mr. Kesavanarrayayayayananananan I assume you do not mean cache them on the browser. You can define a tag in your deployment descriptor. From the other end you can set a Header (setHeader(name, value) on the "Refresh" header name which tells the browser to reload your page. OR you can get a faster computer and have everyone access it by a multiplexed fiber optic connections. Oh, you can look at the book "More Servlets and JavaServer Pages on 478-479 which shows you how to use a compression filter (very impressive) to compress your data (zip it) before it is sent. Most modern browsers will un-zip it for you, so the processing is off loaded to the client. Personally I would definitely go with the faster computer and fiber optic solution. T. Kochanowicz -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Kesavanarayanan, Ramesh (Cognizant) Sent: Monday, August 26, 2002 11:47 PM To: [EMAIL PROTECTED] Subject: caching images Hi all, In my website i have so many images and so it takes time for me to load all the images each and every time from the server. Is there a way i can cache these images so that it saves lot of time for me Regards Ramesh Kesavanarayanan * [EMAIL PROTECTED] === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: pie-chart and bar-charts in java
I haven't used it myself, but I believe there is a program call JFreeChart at http://www.object-refinery.com/jfreechart/ Tom Kochanowicz -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Kesav, Ramesh Sent: Wednesday, May 22, 2002 1:56 AM To: [EMAIL PROTECTED] Subject: pie-chart and bar-charts in java Hi all, can anybody let me have source code for drawing pie-chart and bar-charts in java. Regards Ramesh Kesavanarayanan [EMAIL PROTECTED] === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
What syntax to use
I am reading Hall's more servlets & JSP book. When going through the code he uses mainly directive, declarations, scriplets and expressions that are not xml based. I plan on taking my scwcd exam and was wondering if anyone knew if both types of syntax is being used in the test? I think that even though the xml syntax is more wordy, it will became the accepted standard. Sincerely, Tom Kochanowicz === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: Shutdown Apache/Tomcat
Mark, This may give you a partial answer if you are using NT or 2000. I simply made a restart.bat file which included the two lines: CALL C:\PROGRA~1\APACHE~1\JAKART~1.1\bin\shutdown.bat CALL C:\PROGRA~1\APACHE~1\JAKART~1.1\bin\startup.bat The "real" path on my computer is c:\Program Files Apache Group\jarata-tomcat-4.0.3\bin If you wanted it to be web based, I would think you could write a servlet that does a System call, that calls the restart.bat file. Sincerely, Tom Kochanowicz -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Mark Stray Sent: Wednesday, May 01, 2002 1:16 AM To: [EMAIL PROTECTED] Subject: Shutdown Apache/Tomcat Hi, Can anyone tell me how to give user access to restart the Apache Webserver. Can this be done with a command from the URL? regards, Mark ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Need Help w/ MVC and Database Question #2
Many thanks to those who responded to my question. I have a second question along the same line (kind of). What is the difference between "struts" and "jstl" (java standard tag library)? Is struts designed specifically for the MVC architecture where jstl isn't ? Sincerely, Tom Kochanowicz === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Need Help w/ MVC and Database
Hello, I am trying to do my first project with the MVC architecture (not using struts yet). The examples I look at in books do not have a working example that actually connects to "any" real database and they only show examples loaded a very small amount of data. Does anyone have a "very simple" example of a MVC actually retreiveing data from a database (any database) OR can point me to a link that has an example. (yes I tried google). Sincerely, Tom K === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: ServletPackage in API spec
Sven, You need the servlet.jar file. You can get it in from the Tomcat download. You can put the servlet.jar file in your jsdkX.X/bin directory (assuming you have this directory in your classpath) Then when you compile your program, it should find the javax.servlet.* files. By the way, if you are new to servlets/jsp. Tomcat is a good servlet engine to do your testing on. Sincerely, Tom K -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Sven Hohage Sent: Friday, March 22, 2002 6:26 AM To: [EMAIL PROTECTED] Subject: ServletPackage in API spec I'm reading a JSP book and try to find the servlet package(import javax.servlet.* import javax.servlet.http.*) in the Sun Api Spec which you download with the 1.3.1 SDK. I find java.awt and java.beans and javax.swing but no javax.servlet. What do I misunderstand..? === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: Off topic !
Daniel, follow the following steps, 1) go to google 2) find a DB2 site 3) ask the question there. Hope this helps -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Daniel Bergenhus Sent: Wednesday, March 13, 2002 2:19 AM To: [EMAIL PROTECTED] Subject: Off topic ! I need to know how to invoke a stored procedure from a trigger in IBM DB2 v7.1 Like to se a syntax example ! Daniel = To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com