Hendrik Schreiber,您好!
But i have put such a file under the same folder,i have checked the file name
carefully.
在 00-11-4 11:25:00 您写道:
>Well, it seems that you try to open a file called count.txt that just does not exist.
>
>-hendrik
>- - - - - - - - - - - - - - - - - - - - - - - - - - -
> tagtraum industries http://www.tagtraum.com/
> jo! small&smart 2.2 servletengine
> Java Server & Servlets The web-application book
> The WebApp Framework http://www.webapp.de/
>
>
>Yang cun dong wrote:
>
>> Hendrik Schreiber
>> help me please, I make a counter ,but it reports the errorness as follow. I use
>tomcat3.1
>>
>> Error: 500
>> Location: /website/index/file/jsp/count.jsp
>> Internal Servlet Error:
>>
>> javax.servlet.ServletException: count.txt (系统找不到指定的文件。)
>> at
>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
>> at
>website.index.file.jsp._0002fwebsite_0002findex_0002ffile_0002fjsp_0002fcount_0002ejspcount_jsp_2._jspService(_0002fwebsite_0002findex_0002ffile_0002fjsp_0002fcount_0002ejspcount_jsp_2.java:117)
>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled
>Code)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
>> at
>org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java,
>Compiled Code)
>> at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java,
>Compiled Code)
>> at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled
>Code)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
>> at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
>Compiled Code)
>> at org.apache.tomcat.core.ContextManager.service(ContextManager..java,
>Compiled Code)
>> at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java,
> Compiled Code)
>> at
>org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled
>Code)
>> at java.lang.Thread.run(Thread.java, Compiled Code)
>>
>> Root cause:
>> java.io.FileNotFoundException: count.txt (系统找不到指定的文件。)
>> at java.io.FileInputStream.open(Native Method)
>> at java.io.FileInputStream.(FileInputStream.java, Compiled Code)
>> at java.io.FileReader.(FileReader.java:35)
>> at
>website.index.file.jsp._0002fwebsite_0002findex_0002ffile_0002fjsp_0002fcount_0002ejspcount_jsp_2._jspService(_0002fwebsite_0002findex_0002ffile_0002fjsp_0002fcount_0002ejspcount_jsp_2.java:78)
>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled
>Code)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
>> at
>org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java,
>Compiled Code)
>> at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java,
>Compiled Code)
>> at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled
>Code)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
>> at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
>Compiled Code)
>> at org.apache.tomcat.core.ContextManager.service(ContextManager..java,
>Compiled Code)
>> at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java,
> Compiled Code)
>> at
>org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled
>Code)
>> at java.lang.Thread.run(Thread.java, Compiled Code)
>>
>> 在 00-11-1 12:32:00 您写道:
>> >Hi!
>> >
>> >I currently prefer the following:
>> >
>> > * encapsulate JDBC in some kind of beans or persistence layer. Do not spread SQL
>> > statements all over your application. Do not embed SQL in JSP, even if some
>> > taglib vendors offer that as feature.
>> > * place your servlet independent application logic in your beans or business
>> > objects.
>> > * use a servlet or a logic JSP (no displaying here) to interprete the data you
>> > receive from forms. do whatever you need to do with your database etc. here.
>> > Place the objects you want to display in the request, the session or the
>> > servletcontext, so that it is accessible from a display JSP. Then forward the
>> > request to a display JSP appropriate for displaying whatever you need to
>display.
>> > I.e. there is a 1:n relation between servlet/logic-JSP and display-JSP. There
>> > shouldn't be a lot of code in the servlet. It should merely be used to call
>> > methods of other servlet independent objects. Only the servlet specific code
>has
>> > to be placed here.
>> > * display your stuff with a display JSP. As you put your objects in the request
>(or
>> > session, etc.). you can access them via <jsp:usebean>. In your display JSP
>make
>> > sure you have no or close to no scriptlets. Use a taglib for iteration and
>> > conditional execution (e.g. <customtag:foreach> and <customtag:if>). Write
>more
>> > custom tags for other special display tasks. Do not write tags for stuff
>related
>> > to application logic. Do not write too many tags.
>> >
>> >Why? If you follow the proposed way, you have a chance of achieving the following
>> >goals:
>> >
>> > * separate your application from the web interface (no app logic in the servlet,
>> > just the glue between the web and your app goes here, instead place the
>applogic
>> > in your app beans or business objects)
>> > * the glue/servlet code and the app code can be written and maintained by real
>> > programmers, not HTML guys (no offense, HTML guys, it is really difficult to
>do
>> > HTML and Java, but most people do only know to do either one really well)
>> > * the display JSP can be written and maintained by HTML guys who learn some
>extra
>> > stuff like iteration with custom tags and JSP expressions (e.g.
>> > <%=person.getName()%>)
>> > * JDBC is hidden, so not everybody has to know everything about the underlying
>> > tables and has to be an expert in how to efficiently do joins etc.. Also you
>can
>> > reuse PreparedStatements (*in theory* that gives you a performance boost) and
>> > don't have to deal with SQL all that much
>> >
>> >Well, even if you don't follow 'the proposed way' you have a chance to achieve
>these
>> >goals :-)
>> >This is just my opinion about the whole thing if you want to do it with
>JSP/Servlets.
>> >It is certainly not the only way to go. Also there are still EJB and XML/XSL(T) and
>> >....
>> >
>> >cheers,
>> >
>> >-hendrik
>> >- - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > tagtraum industries http://www.tagtraum.com/
>> > jo! small&smart 2.2 servletengine
>> > Java Server & Servlets The web-application book
>> > The WebApp Framework http://www.webapp.de/
>> >
>> >
>> >Thang Nguyen wrote:
>> >
>> >> Hi,
>> >>
>> >> I have this fundalmental question. I hope you can shed some lights for me. I
>am
>> >> looking to see what would be a common solution to my application.
>> >>
>> >> My project is a web based application which will retrieve values from the
>informix
>> >> database, manupulate them, and send the results back to the requestors. As far
>as
>> >> I understand, and was able to run a few examples, I noticed these:
>> >>
>> >> (1) JSP can use JDBC to communicate with database directly
>> >> (2) Servlet can use JDBC to communicate with database directly
>> >> (3) Service Beans can use JDBC to communicate with database directly
>> >> (4) JSP can call Servlet as well as Java Bean
>> >>
>> >> So, what should I use, since the scope of this project can be larger? I am
>> >> looking for these qualities: fast, easy to maintain, and simple.
>> >>
>> >> (1) just use JSP only, use HTML like tag for visual, and JDBDC directly
>> >> for accessing database?
>> >>
>> >> or
>> >> (2) use JSP and Servlets, use HTML like tag for visual, and Servlets
>(jdbc
>> >> embeded) for accessing database?
>> >>
>> >> or
>> >> (3) use JSP with Java Beans, use Visual Bean for visual and Service Bean
>> >> (jdbc embeded) for accessing database.?
>> >>
>> >> Please help. Thank you very much for your time.
>> >>
>> >> TN
>> >
>> >===========================================================================
>> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>> >Some relevant FAQs on JSP/Servlets can be found at:
>> >
>> > http://java.sun.com/products/jsp/faq.html
>> > http://www.esperanto.org.nz/jsp/jspfaq.html
>> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>>
>> 致
>> 礼!
>>
>> ycd
>> [EMAIL PROTECTED]
>>
>> ===========================================================================
>> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>> Some relevant FAQs on JSP/Servlets can be found at:
>>
>> http://java.sun.com/products/jsp/faq.html
>> http://www.esperanto.org.nz/jsp/jspfaq.html
>> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
致
礼!
ycd
[EMAIL PROTECTED]
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets