Re: Trouble with web.xml
Matt Campbell wrote: .. > I have been getting around that by compling using javac with the destination > directory set to my TOMCAT_HOME/webapps/myapp/WEB_INF/classes directory. This > all works, my HelloWorld.class servlet runs like a beauty :) My next problem is > that I cannot get my servlets to recognize web.xml. I place this file in > WEB-INF directory for the web app, but any init-param I try and use comes back > as null. I am sure I have the syntax of the web.xml file correct. This even > happens when I place my servlets in TOMCAT_HOME/webapps/examples/WEB-INF/classes > directory and edit the pre-existing web.xml file to include my init-params. If you change web.xml, you must restart Tomcat WBB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Trouble with web.xml P.S.
Matt Campbell wrote: > > Hi All, > > this is an addition to my last post, a bit more info in case its any use. I've > just tried to run > TOMCAT_HOME/webapps/examples/WEB-INF/classes/SnoopServlet.class after > un-commenting its init-params in TOMCAT_HOME/webapps/examples/WEB-INF/web.xml > The servlet runs fine, except that it doesnt find its init-params. I have made > no changes except for un-commenting those params. Why wont it find them?? > > Cheers > > Matt > Ah yes - this annoying little quirk. If you address SnoopServlet.class directly as above, Tomcat does NOT associate it with the entry in web.xml therefore you don't get init params. If you address it as snoop - the alias that the web.xml sets up with: snoop SnoopServlet foo bar then you will get the init params -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: a few strange problems
Thomas Bartels wrote: > > I recently installed Tomcat 3.2.1 on a RedHat 6.2 Linux System and have > come across some strange issues. I am using it solely for the jsp > functionality not for servlets. I am running it in conjunction with > Apache 1.3.12(to serve static content, images etc.) > > Whenever I do an include, from a .jsp file, that passes a param value > with ' ' in the value string I get some really strange exceptions, > the first exception is a FileNotFoundException, all of the included > files are referred to relatively i.e. "../header.jsp" and do exist, if I > remove the ".." I can get rid of the FileNotFoundException. Ok, but now > I get: Internal Servlet Error: javax.servlet.ServletException; Root > Cause: java.lang.IllegalArgumentException. (please let me know if you > need more info than that as the full errors were much longer etc.) > Finally, to fix this, I remove the ' ' from the param line in the > include statement below. > > > > I am betting that the & confuses the request parser because of the similarity to the way form parameters are passed, but I don't know why that would generate those exceptions. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Problem in starting tomcat
> Andrew Tan wrote: > > I installed tomcat on Windows98 > When I double click on "startup.bat" it says opening in another window > (the window comes on and then disappears). And it seems that tomcat > has not started. > > Do you have similar experience? and is there a solution? > > Regards, > Andrew 1) Open an MSDOS Prompt window 2) Right click the upper left corner -> select properties 3) on the memory tab of the properties dialog, change the initial environment to 3072 or 4096. The reason being that startup.bat adds LOTS of strings to the environment, too much for the normal win98 setting. 4) change directory to tomcat\bin and execute startup.bat if it doesn't work, at least you will be able to see error msg. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Ctx( ): IOException in: R( + /images/dm2.gif + null) socket write error (code=10053)
Each getImage starts a separate Thread and separate request so it is no wonder you are running into problems. Your applet should use MediaTracker and only do a few Threads at a time. It is also much faster to load a few images and cut them up in the Applet - assuming your big collection comes from cutting up a few images. > Maxim Senin wrote: > > Hi, > > I have this problem loading hundreds of images in my applet from the > server (Tomcat 3.2.1) with ~ following code: > > // in applet.init()... > for (int i=0; i<1000; i++) { > URL location = getClass().getResource ("/images/image"+i+".gif"); > Image img = this.getImage (location); > if (img != null) > images.addElement (img); > } > // ... > > After loading ~50-60 images this way, I start to get > > Ctx( ): IOException in: R( + /images/imageX.gif + null) socket > write error (code=10053) > > for all resources including classes of applet being loaded by class > loader. > > PLEASE HELP!!! > > Cheers, > Maxim -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: jsp can´t find tag library file.
> Antillon Reyes Rafael Martin - EXT wrote: > > Hi all. > > My problem is that the jsp i run can´t find the tld i specified. > I´ve tried some things, but i don´t know what to do. > This is the code: > > > <%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %> > > Where does the file has to be? > > what else do i have to specify in tomcat 3.1, wich is the one i´m > using? > > any idea?? > Your web.xml file must also include taglib information - example: JSPbook/taglib /WEB-INF/jsp/JSPbook-taglib.tld See the JSP API documentation - everybody should have a copy. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: applet communicating a servlet
David Treves wrote: > > Hi, > > I am looking for a "How to" document about that subject, does anyone > know of a good article? > > thanks, > David. > The http://javaranch.com/common.jsp collection of methods -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: error message new help
Nael Mohammad wrote: > > Hey Community, you have two people with the same error message, now can we > get some suggestions. Thanks > > Nael > > [EMAIL PROTECTED] > Root cause: > > java.lang.NoClassDefFoundError: sun/tools/javac/Main > at > org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128) > That looks pretty obvious to me. The javac package is in tools.jar, which Tomcat is not finding. Suggested cure: find tools.jar and put it on the Tomcat classpath -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Reserved parameter names?
Chris Janicki wrote: > > I've discovered (after some frustration) than certain variable names used > in an HTML form won't be passed to my bean via the "jsp:setProperty" tag. > For example, using "page" as a name doesn't work. I *can* explicitly > set it via: > > myBean.setPage(request.getProperty("page")); > > But this name won't get set automatically, while other names do, all in > the same form. > > Are there "reserved" names that I need to avoid when making forms to be > handled by Tomcat? Is there a list of them? > > Thanks, > Chris > That is because of the "Implicit Objects" in the JSP standard: request, response, pageContext,session, application, out, config, page and exception There is a really useful 2 page summary you can download from java.sun.com named something like "Javaserver Pages Technology Syntax" that includes this list. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: performance
There are a lot of design decisions with Java that have a great effect on throughput. I found the following book very enlightening: Java Performance and Scalability vol 1. by Dov Bulka pub by Addison Wesley ISBN 0 201 70429 3 -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: newbie writing a logout.jsp
Don't confuse what happens on the browser with what happens on the server. The cookie value that JSP uses to find the HttpSession object may be lost from the browser when it closes but the servlet engine still has the object in memory. You can explicitly destroy the HttpSession object by session.invalidate() or you can just let it time out and be invalidated by the engine. Dick Poon wrote: > > Hi Jason, > > I am new an expert in JSP yet,but I think logout page not necessarily > destroy user's session bean. > Actually I just wrote an online shopping cart by JSP in which the logout > page just remove the "user bean". > A session bean would be destroy only if you close the browser.(session bean > here means the beans with a scope of > session) > > Dick Poon > - Original Message - > From: Jason Novotny <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, February 03, 2001 5:56 AM > Subject: newbie writing a logout.jsp > > > > > I have a logout JSP page that destroys a user's session bean. How can > I > > prevent them from hitting the back button in their browser to display the > > previous pages- like a set no-cache I suppose. > > > > Thanks, Jason > > > > > > -- > > Jason Novotny [EMAIL PROTECTED] > > Home: (510) 704-9917Work: (510) 486-8662 > > NERSC Distributed Computing http://www-didc.lbl.gov > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, email: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Can't see line numbers in exceptions
Angus M wrote: > > When I dump a stack trace the the brower or to the tomcat log I can seem > to see the line numbers in the trace. How do I turn this on? > > build.xml snippet: > > classpath="${deploy.home}/WEB-INF/classes" >debug="on" optimize="off" deprecation="off"/> > > > > > > Stack Trace: > java.lang.NullPointerException > at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code) > at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code) I can think of two possible reasons you are seeing Compiled Code instead of line numbers. 1) you need to compile with the option that leaves line number information in the .class file. See the compiler options in the tooldocs. 2) you need to run without the JIT compiler because it discards line number information. Try setting the environment variable set JAVA_COMPILER=NONE -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Can't see line numbers in exceptions
Angus M wrote: > > William Brogden wrote: > > > > Angus M wrote: > > > > > > When I dump a stack trace the the brower or to the tomcat log I can seem > > > to see the line numbers in the trace. How do I turn this on? > > > > > > build.xml snippet: > > > > > > > >classpath="${deploy.home}/WEB-INF/classes" > > >debug="on" optimize="off" deprecation="off"/> > > > > > > > > > > > > > > > > > > Stack Trace: > > > java.lang.NullPointerException > > > at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code) > > > at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code) > > > > I can think of two possible reasons you are seeing Compiled Code > > instead of line numbers. > > > > 1) you need to compile with the option that leaves line number > >information in the .class file. See the compiler options in the > >tooldocs. > > Um, did you read the build.xml snippet? debug="on" Or is there some > other switch? That should ensure complete debug information in the .class file. > > > > > 2) you need to run without the JIT compiler because it discards > >line number information. Try setting the environment variable > > > > set JAVA_COMPILER=NONE > > > > Which file should I put this in so that I don't have to worry about it > being sent for and auto-startup by the server on reboot? This environment variable needs to be in effect before Tomcat starts. Since it is going to slow down the response considerably, you better put it somewhere that you won't forget about it when time comes to deploy your application. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: quick Tomcat question
R N Mukherjee wrote: > > SUB: is TOMCAT is a JSP ENGINE + SERVELET ENGINE or ONLY A JSP ENGINE.?? > > If it is JSP + Servelets then why we have to run JSDK for testing the JSP > files.? > You should totally remove all traces of JSDK library from your system because the jsdk.jar library interferes with the more up to date Tomcat library - servlet.jar -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: A lot of params equals in web.xml
Alberto wrote: > > Hi everyone. > I've a question: > in my web.xml I have a lot of servlets that use the same set of parameters > (same param name, same param value). The value of these parameters could > change a lot of time in a month so: > there's a way to write only one set of param name / param value and call it > in all my servlet? > Sure - create all of those name/value pairs in a properties file and have web.xml point to it. In your init method use a java.util.Properties object to read the properties file and recover the parameters that servlet needs. I do this all the time, makes it easy to synchronize all servlets with the same properties. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: What means HTTP 400?
Rogério Meneguelli Gatto wrote: > > Hi, guys, > > What is a HTTP 400 status/error? I'm seeing a lot of these in my tomcat.log: > > 2001-02-05 01:27:17 - Ctx( ): 400 R( /) null > Look in the Tomcat \webapps\ROOT\docs\api Javadocs for the HttpServletResponse class documentation - there you will find a complete list of the status codes -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: howto include static content in a JSP file
[EMAIL PROTECTED] wrote: > > How do I include a file in a JSP-file? What tag do I use? I'm using > Tomcat 3.1. > > Regards, > David > I heartily recommend that you obtain the JSP API documentation from java.sun.com - there you will find the answers to many questions. You can also find a handy 2 page summary of JSP syntax. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
HttpSession timeout
In your web.xml you should find: 30 30 is timeout in minutes. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: errorpage.jsp: Can't convert javax.servlet.jsp.JspWriter to java.io.PrintWriter
Jason Novotny wrote: > > I've been learning JSP with this great book from manning.com and > I've been trying to write an error page. According to the book, I should > be able to do the following: > > <%@ page isErrorPage="true"%> > The following error has been detected: > > <%= exception %> > > <% exception.printStackTrace(out); %> > > However, when I try this I get the following: > > gpdk/_0002fjsp_0002ferror_0002ejsperror_jsp_14.java:143: Incompatible > type for method. Can't convert javax.servlet.jsp.JspWriter to > java.io.PrintWriter. > exception.printStackTrace(out); >^ > 1 error > > What's the secret to printing a stack trace to the page? You can't cast the JspWriter to a PrintWriter so what you have to do is create a StringWriter, use that to make a PrintWriter and print the stack trace to it. Then just use the toString() method of StringWriter to get a single string with the full trace. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Installing Tomcat windows 98
> > Just type the following line to set aside enough memory in DOS environment before >typing startup > > C:\COMMAND.COM /E:4096 /P > > Obviously, "4096" means 4MB! > NO it does not - it is literally 4096 - the Environment space is what stores environment variables like JAVA_HOME and PATH. Tomcat uses a lot of environment space - look at startup.bat to see the manipulation of environment variables. Win98 defaults to some small number of bytes for MS-DOS prompt windows environment space so you will get an out of environment space message if you don't increase it. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: tomcat only executes certain beans
Trish wrote: > > i have installed tomcat 3.1.1 on SPARC/Solaris 7 platform. everything is > working fine except that the application i am trying to run/test gives an > error: > > org.apache.jasper.JasperException: Cannot find any information on property > 'UserId' in a bean of type 'com.ppd.beans.CrfUser' I suspect you are encountering the convention that expects the property name to start with a lower case letter. Try renaming it userId. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xsl java extensions won't work in tomcat
[EMAIL PROTECTED] wrote: > > hi all, > > i have an xsl stylesheet that includes calls to a java class of my own > devising. when i call this stylesheet via the command line (bypassing > tomcat), everything works just swell. However, when the same thing is > called from within a jsp page, i get the following error: > > Call to extension function failed: File > >"file:/home/dschneid/cvs/cms/rosebud20/com/thestreet/cms/stylesheet/com.thestreet.cms.stylesheet.StylesheetDBHandler" . clip > the stylesheet and the class file are in the same directory. That is the key point. Web resources such as style sheets, images, applet class files can NOT be served from the WEB-INF/ directories The simplest thing to do is to specify a URL pointing to a URL where these resources live. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: configuring web.xml
Chahal Damendra wrote: > > I am trying to run my own servlets that are placed in the appropriate > directories (which are sub directories of Web-inf\classes). Can you advise > on how to modify the web.xml file and where i can find information regarding > the tag definitions > > Regards > > Damendra Everybody working with servlets and JSP should get the API documents from the java.sun.com site. Therein you will find great detail on what goes into web.xml and how that is related to web applications. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Tomcat3.2.1 with IIS5
Steve Wong wrote: > > I have the green arrow in the ISAPI filter in Internet Manager. > I can browse http://localhost/examples/jsp/index.html > But when I browse http://localhost/examples/servlet/HelloWorldExample > It shows: The Page cannot be displayed. > There is no error in the isapi.log > And there's a warning in Window's event log saying the specified metadata > not found. > Does anyone know why? I don't know why, but you can get rid of that "friendly" browser message and see what the servlet is actually sending by changing your browser settings. Tools->Internet Options -> advanced make sure the "Show Friendly HTTP Error Messages" is not checked. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Tomcat
Julie Ruiz wrote: > > Hi, > > Where can I find a configuration manual of Tomcat??? > A manual that explain all the directives that we can configure in the server.xml and >in the web.xml. > > Julie Ruiz. > Configuring web.xml is covered in detail in the servlets API documentation - download it in PDF format from java.sun.com -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Removing vales from Request Object
Shahed Ali wrote: > > Hi, > > Is there some way in which I can remove values in > the request object before forwarding from my servlet > to a jsp page ? See the removeAttribute method in the ServletRequest class. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: load on start-uo
Neil Wood wrote: > > How do I get a servlet to load up on start-up of tomcat. > > probably easy but I dont know how to? > > where can i find answers to questions that are similar to this one? > Read the documentation, study the Tomcat examples - especially the way web.xml is used, download the servlet and JSP APIs from java.sun.com You will find your answers a LOT faster than by bombarding this list. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: newbie help
Number one note for newbies. STOP sending HTML formatted email to the list. Plain text only please. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: /servlet
Josh wrote: > > I'm beginning to thing no one knows the answer to this question. Can > anyone help me? Does anyone currently have their setup as follows? > > As far as I can tell, tomcat doesn't have a way to just allow a /servlet > directory so I can put all my .java, .class, and .jar files in like most > servlet install files ask, am I missing something? It appears that I have > to use the webapps directory, then have the WEB-INF directory structure > below it. Is that right? > > Josh The servlet 2.1 API lays down the law about the directory structure for "Web applications" - WEB-INF is required. JRun 3.0 provides for a JRun/servlets directory to accommodate old style configurations, but you might as well bite the bullet and move to WEB-INF -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Problem with cache
> matteo belloni wrote: > > I've a servlet that write on a file. > If the Tomcat is running the first time the application rewrite the > file, the other time this file is appended but, If I first shutdown > the webserver, the information in a file isn't appended and the > application function correctly. > This appen because this file is keeping in the web server's cache. > How can I solve this problem and writing every time on a file instead > of append the information? I must modify web.xml? And how? > Please help me. > Thanks in advance Sounds to me like you are not flushing and/or closing the file. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Problem with cache
Tomcat does not cache files as such. Your problem must come from a different source. matteo belloni wrote: > > No I close it and after rewriting I deleted it and this file appear really > deleted but Tomcat mantain it in cache so my deletion is inutil. > Thanks > Theo > - Original Message - > From: "William Brogden" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 01, 2001 1:52 PM > Subject: Re: Problem with cache > > > > > > > > matteo belloni wrote: > > > > > > I've a servlet that write on a file. > > > If the Tomcat is running the first time the application rewrite the > > > file, the other time this file is appended but, If I first shutdown > > > the webserver, the information in a file isn't appended and the > > > application function correctly. > > > This appen because this file is keeping in the web server's cache. > > > How can I solve this problem and writing every time on a file instead > > > of append the information? I must modify web.xml? And how? > > > Please help me. > > > Thanks in advance > > > > Sounds to me like you are not flushing and/or closing the file. > > > > -- > > WBB - [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: useing beans.
Pater Pandoson wrote: > > Hello > > My jsp pages work fine but when I try to use beans I get this > > 2001-03-01 12:10:19 - Ctx( ): Exception in: R( + /test.jsp + null) - > javax.servlet.ServletException: try to access class NormalizeText from > class _0002ftest_0002ejsptest_jsp_4 > at > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399) ... snip > The bean is in the classes dir and compled fine > > and the jsp page looks like this > > > > > So can any one tell me what I am doing wrong. > > Thanks. You need to put your bean in a package and specify the package completely in the useBean tag. Apparently, when Tomcat sees the kind of usage you show, it assumes that the class is in the "current" directory. WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: loading applet from web-inf/classes sunfolder
"Jost, Dominique" wrote: > > hi > > my home-directory on the tomcat server looks like this >http://localhost:8080/fundopt. under fundopt i have a folder (called jsp) containing >all my jsp files. > i want to acces an applet (which has its source files in the web-inf/classes/xy >folder) with the following piece of code: > from jsp file (in http://localhost:8080/fundopt/jsp/appletCaller.jsp) > . this >however doesn't work. > > how can i address the applet? what codebase am i to choose? > The form of codebase you are using only works for plain HTML pages. One easy way to solve this problem and also make image and sound files work right is to put a tag in the section of the page your JSP writes. Use that tag to point to the server alias for the directory that has your class files. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Background Threads and JSP
Ryan Detert wrote: > > I have a generic public class containing a Vector that implements Runnable. I > then have a subclassed singleton that I getInstance() in a jsp page to make > sure that the browser clients are all using the same Vector. > > I want to add an element to the Vector every 4 seconds using Thread.sleep(). I > am trying to access this Vector in a jsp page by reloading the browser every 4 > seconds. The page is supposed to display the contents of the Vector. The > generic class' run method is posted below. > > when I run this method the jsp page seems to be eternally hung. without the > synchronized{} statement the Vector would get updated once and that would be > all. > > public void run(){ > > runThread = true; > try{ > synchronized(this) { >while(runThread){ > Thread.sleep(4000); > imageURLs.addElement("barley"); > notifyAll(); >} > } >} catch (Exception e){ } > } > > Anyone know why it doesn't seem to work? > > -thanx > Ryan The Thread that is sleeping does NOT release the synchronized lock! I don't think you need to synchronize this code at all. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Overriding JspWriter/JspFactory
Jim Cheesman wrote: > > Is there anyway to redirect the JSP output (in my case xml, html and wml) > to a file? > > The web.xml that tomcat uses on startup has the servlet > org.apache.jasper.runtime.JspServlet controlling the JspFactoryImpl (and > JspWriterImpl, PageContextImpl etc.) implementations, but I'd rather not > have to reimplement the classes in this pacakage if there is a simpler way > to do it. > > Any ideas? > > Jim > I have seen suggested that you simply create another local application which sends a request to the JSP URL (emulating a browser) and captures the result to file. This has the advantage of not altering your JSP code. WBB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: threading issues with tomcat
Byrom Robert-LRB005 wrote: > > hello all > > Im hoping someone can help, > > can someone please explain how the threading works when a new servlet is initialised >within the tomcat container? If multiple requests are recieved for a servlet, is the >same servlet data area shared amongst each thread that invokes the servlet? and if >many requests are made for the same servet, how does tomcat deal with the demand? Only a single servlet object exists in the container but there can be many Threads executing in the code. Each Thread has a request object and response object (and possibly a session object) belonging to a particular request. Each Thread shares the instance variables of the servlet but local variables in servlet methods are unique to the Thread. Thats why you should not use servlet instance variables for anything unique to a particular request. Data that has to be associated with a particular user between requests should be stored in the session. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: threading issues with tomcat
Byrom Robert-LRB005 wrote: > > thanks for the help, > > one further question, if I initialise a Database connection within the init() >method of a servlet and use this reference in the doGet() for example, will each >servlet share this connection object? ie if more than one servlet requests the same >connection would this result in a runtime exception? > Resources such as DB connections have to be specially managed servlets to ensure that only one Thread is using a connection at one time. Look for recent discussions of connection pools in this mailing list. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Please !!! I seek some documentation about web.xml file
1) The example web.xml and web.dtd that come with Tomcat 2) The Java servlet API - download from java.sun.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: problems with conf
You can not rely on any directory being the default directory. Thats why the API specifies the directories WEB-INF.classes, WEB-INF.lib to be used for class and jar files in web applications. You should study the way the Tomcat examples are organized, especially the web.xml file. You should also download the servlet API from java.sun.com and study it. Many things about the organization of directories and files are nailed down in the API. [EMAIL PROTECTED] wrote: > > hi, I am trying to execute servelets, does anyone know the default directory > where servelets and JSP scripts are executed in Tomcat. Because I don't > know I figured I could set the directory where Servelets and JSP scripts can > be executed in "server.xml" however when I click on it , Internet Explorer > opens up and I get this message : > > The XML page cannot be displayed > Cannot view XML input using XSL style sheet. Please correct the error and > then click the Refresh button, or try again later. > -- > > -- > Reference to undeclared namespace prefix: 'xmlmapper'. Line 5, Position 34 > > > > can anyone help > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Optimizing Tomcat
Richard Seymour wrote: > > Is there anything like a "Ten Things you can do to Optimize Tomcat" > document? > > I've just dropped a web app onto a dual Pentium Pro box and it's running > unacceptably slow. > > I just want to see a list of steps I might take to get the most out of > the box. > The following book is full of insights on Java server performance: Java performance and scalability, Vol 1, Server-side programming techniques by Dov Bulka, published by Addison-Wesley, ISBN 0-201-70429-3 -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Servlets work, JSP pages don't - WHY?
Peter Adamek wrote: > > I installed Apache and Jakarta-Tomcat on my Linux box > running RH 7. Basically, I created a new context > in the document root directory and tried to write my > own servlets and jsp pages. Well, servlets work OK, > jsp pages don't > Internal Servlet Error: > > javax.servlet.ServletException: sun/tools/javac/Main > at It is looking for the compiler that lives in the tools.jar file which cames in the JDK. You have to supply this by putting it in the classpath. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: JSP, beans JRUN and TOMCAT 3.2.1 (embedded JBOSS) HELP
Joel Cordonnier wrote: > > Hi! > > I have to port an application that run on JRUN to > embedded JOBSS-TOMCAT3.2.1 > > in my JSP pages i have the following > > <%@page > import="de.hyphony.application.ebtf.viewValue.loginPortlet.IVV_vd_login_input"%> > scope="request"/> > ... > > IVV_vd_login_input is an INTERFACE !!! > > JRUN compile the JSP page without problem, and TOMCAT > NOT (it's an interface) > IS this portable ? > > Thanks > Joel In your http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Colombo Java mystery -- the case of the unrecognized Parser jar
Kemp Randy-W18971 wrote: > > Here is a Colombo mystery I am wrestling with, called the case of the unrecognized >Parser jar. See if you have any insights. > > 1. On windows 2000, I get this message when running Resin or Tomcat. > > Error: 500 Internal Servlet Error: > javax.servlet.ServletException: org/xml/sax/EntityResolver > 2. If I look at my classpath, I have Parser.jar in it. >(http://localhost:8080/JSP page entry) When something like this happened to me it turned out to be another JAR file that had the org.xml.sax package in it being picked up first. In my case it was in the JAVA_HOME /jre/lib/ext directory that gets picked up as part of the default class lookup before the classpath is examined. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: JSP, sessions: how to notify bean about the session end?
"Sergey V. Udaltsov" wrote: > > Hello all > > My JSPs uses some session-scoped bean. This bean, among other duties, is > responsible for logging in and out of some app server. I would like the > bean to perform autologout on the session end. Is it possible? How? > AFAIK usual finalize can be called ages after the object is really free > - so I do not like this way. Any ideas? > > Regards, > > Sergey > Take a look at the HttpSessionBindingListener interface. If your Bean implements this class, you can get a notification when the session times out or is otherwise invalidated. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: NullPointerException
William Au wrote: > > Thanks for the reply. But I am sure the NullPointerException is coming > from within Tomcat. I got them while accessing a static page with > no JSP code. So how do I test if pointers with "x.equals(null)"??? > The exceptions do not show up when I access the page manually > through a browser. They come when I run a load test and multiple > clients issuing requests at the same time. > > Bill > x.equals( null ) will in fact cause a NullPointerException You must use if( x == null ) to test. WBB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Applet-servlet communication examples
http://javaranch.com/common.jsp Look for the HTTP, ObjectServlet and Servlets packages. JavaRanch also hosts a servlets discussion board http://www.javaranch.com/cgi-bin/ubb/Ultimate.cgi -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Applets, Servlets, Security issues
"Caprio, Mike" wrote: > > Hi folks, > > I'm hoping someone on the list can point me in the right direction > on a problem I'm having with applet to servlet communication. > Specifically, I'm getting: > > java.security.AccessControlException: > access denied (java.lang.RuntimePermission modifyThreadGroup) > > when I send an event to the applet that should start the applet to > servlet communications. That is a very specific exception - what are you trying to do with a Thread when it occurs? -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Java Shutdown?? - Help
Mick Sullivan wrote: > > Hi all > Everytime I load a certain JSP page in my application I get a Java alert box > saying: > "This program has performed an illegal operation and will be shutdown. If > the problem persists, contact the vendor" > There is a 'details' button with loads of Machine code in it. > When I press the 'close' button the Tomcat window shuts down :-( > I just want to know if this a known bug in Tomcat or has it something to do > with my code, > Thanks in advance, Mick Straight Java code can't perform an illegal operation -possibilities are: 1) your code calls a native method that has a bug 2) your JVM has been damaged
Re: problem with JSP displaying broken image link
> jdh wrote: > > I have been having trouble displaying images from my JSP(s). It > seems like all my images that exist on http://www.geocities.com come > up as broken image links.Is there a bug in the JSP server? I can > display those images as plain .html file but not in my JSP. > > Thanks. I would start by capturing the generated page (view source) and carefully examining the way the links are being written. Is it valid HTML? -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Newbie Group
Arafat Mohamed wrote: > > There was a discussion a while ago about starting a Tomcat newbie group. > Anyone know where that ended up? There is a newbie discussion running at www.javaranch.com - pick the "saloon" option. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: PLEASE READ LIST ADMINISTRATORS (original subject was . )
"Michael G. Anderson" wrote: > > Scott, > > I know this is phucked and a lot of work but -- at the bottom -- "Please email > [EMAIL PROTECTED] with the email address that > you would like removed and the word REMOVE in the subject heading." > > RIE > Bullshit - those scumbags just use your reply to verify that it is a live address. Instead forward the entire mail to [EMAIL PROTECTED]
Re: Problem accessing a bean from a jsp page...
Jason Sardano wrote: > > I created a jsp page that uses a custom bean. When I try to access the jsp > page, I get the error listed below. I don't understand what is going on; my > java file compiled correctly, I put the package in my jsp page's > WEB-INF\classes directory, yet I receive this error. Does anyone have any > suggestions? > > Thank you, > Jason Sardano > > Error: 500 > Location: /lobster/index.jsp > Internal Servlet Error: > > javax.servlet.ServletException: JasonTest/DataBean > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled > Code) .. > Root cause: > java.lang.NoClassDefFoundError: JasonTest/DataBean > at > _0002findex_0002ejspindex_jsp_0._jspService(_0002findex_0002ejspindex_jsp_0. > java:66) One typical reason is that you didn't provide the complete package in the class= attribute of your http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Java Question on Inheritance
Ryan wrote: > > Then this is my next problem. > > I currently have getThumb() returning an Image object. > > The part where I am stuck at is what to do in the toURL() method. > > my mock getThumb() method currently looks something like > public Image getThumb(){ > this.iValue = "/home/thumbs"; > return this; > } Exactly what are you going to do with an Image on the server side? A request from a browser will be for an image file in something like .gif of .jpg format. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Checking for timed-out sessions
A Yang wrote: > > Hi, > > Can anyone tell me what the proper convention for > checking for invalidated sessions is? Do people really > write code checking for whether the session is valid > EVERY time they are about to refer to one? And if so, > do they just examine the LastAccessedTime and create a > new session accordingly? If a session gets invalidated, you can't get at it any more. A call to getSession() will create a new one. You can examine a session with isNew() to see if it was just created. > > If this is the case, then you'd think that part of the > base class functionality would be a method that > automatically compares it to the MaxInactiveInterval - > instead of making me subclass HttpSession myself8) > > Also, is the behaviour of a timed-out session defined > if I try to access one? Does Tomcat automatically > invalidate the session after it exceeds the > session-timeout value? Yes there is a Thread that does session upkeep. Look into the HttpSessionBindingListener for a way to be notified when a session is invalidated. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Request 2 times received
Reto Badertscher wrote: > > When generating and sending a rtf file from a servlet, the browser ask for > - display from current location > - saving the document > > When "display from current location" is chosen by the user, the servlet > receives a second request (that means the file will be generated a second > time), when "saving the document" no additional request is sent to the > servlet. > The following parameters are set for sending the rtf document: > aRes.setContentType("application/rtf"); > aRes.setHeader("Content-disposition","attachement;filename = > myDocument.doc"); > This is just a guess, but - Do you think the second request might be checking to see if the date last modified has changed? Suppose you create a getLastModified method? -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: importing multiple packages
Kris Gonzalez wrote: > > tej... > > you have to use multiple import items, one for each class or package you're > importing > > such as: > > <%@ page language="java" import="java.util.*" import="java.io.*" %> According to the spec, you import multiple items as a comma separated list. <%@ page language="java" import="java.util.*,java.io.*" %> -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: BookDOMbean class not found
MingLong Wu wrote: > > Hi, > > I got the following error when I type > http://localhost:8080/JSPbook/Chap06/BookTopics.jsp > > Error: 500 > > Location: /JSPbook/Chap06\BookTopics.jsp > > Internal Servlet Error: > > org.apache.jasper.JasperException: Unable to compile class for > >JSPC:\tomcat\work\localhost_8080%2FJSPbook\_0002fChap_00030_00036_0002fBookTopics_0002ejspBookTopics_jsp_1.java:66: > Class com.JSPbook.Chap06.BookDOMbean not found. > com.JSPbook.Chap06.BookDOMbean bookBean = null; . > I do success compile and get BookDOMbean.class. Can anyone tell me what it > means? you have to put BookDOMbean.class where the compiler can find it, according to the servlet specification, this is under the WEB-INV classes directory structure. WEB-INF\classes\com\JSPbook\Chap06\
Re: javax.servlet not found
Sathya Narayanan wrote: > > Hi, > > When I compile a servlet, "javac HelloWorldExample.java" > I get the error > package javax.servlet and javax.servlet.http not found > > I have installed jdk1.2.2 and the tools.jar file is put in the in the > classpath. the javax.servlet.* packages are in servlet.jar which should have come with your Tomcat installation. Since this is a "standard extension" library, copy servlet.jar to yourJDK/jre/lib/ext which is where javac looks for standard extensions. Alternately you could put it on your classpath, or otherwise specify it to the compiler. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: Can't find SAXParserFactory
Mike Campbell wrote: > > > > Exception in thread "main" java.lang.NoClassDefFoundError: >javax/xml/parsers/SAXParserFactory > > > > > The file should be within $TOMCAT_HOME/lib/xml.jar. > > > > Which version did you download tomcat ? > > I downloaded the binary version 3.1 (from >http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/). I'm hoping I got the >correct > version. > > My xml.jar file does NOT have this file (nor does it even have this directory >hierarchy (javax/xml/parsers). > > Hrm. > > Do you have a \lib\jaxp.jar file? Another person told me to check this. >And I don't have that jar file either. Where does > THAT come from? The javax/xml/parsers package in from JAXP - the current official parser from Sun - download at java.sun.com/xml -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: help with generated servlet and IllegalStateException
Elisabeth Freeman wrote: > > Hi, > I have noticed that the servlets being generated from my JSPs *always* grap > the PrintWriter "out", even if I am not using it in my JSP. This causes > serious problems when I want to redirect - I get an IllegalStateException > which seems to hang the thread in my application, so after a few hundred > hits, the application is dying (on Windows NT, doens't seem to happen on > Windows 2K). Is there any way for me to direct Jasper *not* to get the > print writer at all in the generated servlet? > > Thanks!!! > > Elisabeth Freeman If you are not going to be writing any HTML, why bother with JSP? Why not do whatever it is you are doing with a servlet? -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Tomcat and Style sheets
I am getting weird results when trying to get Tomcat to serve pages that link to style sheets. Example link: Catalog Information http://localhost:8080/XmlBook/catalog/catalog.css" type="text/css" media="screen" > I tried adding css text/css to the general web.xml in tomcat/conf following the style of the other mime-mapping entries but I still don't seem to get the catalog.css served. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: BeanInfo
> Prashant Rao wrote: > > Hi I am new to Tomcat. I am trying to incorporate my own beans in > JSP. However I am unable to access the form variables in the beans > though the bean is instantiated on execution of the JSP execution. > Going through the archives I found the some articles on including > the BeanInfo class for each bean. > Do I have to create the beaninfo class for each bean If so what > are the required methods in the class and where do i put the > beanInfo class ? You don't have to create a BeanInfo. The usual reason for this problem has to do with naming your variables and the setX methods. Your variable name must start with a lower case letter and the set method must change that to upper case. String myName ; public void setMyName( String s ) { myName = s ; } -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
mime-mapping - what is it supposed to do?
What exactly is the tag in web.xml supposed to control? I commented out all of the mappings and Tomcat appeared to serve image files just fine. -- WBB
Re: Frustration with getInitParameter
Paul Hoepfner-Homme wrote: > > Just so y'all know, I can use context-params fine, but no > init-params for my servlet work at all. It is useless to define > tags in between my tags in web.xml because > Tomcat doesn't register them or make them available to my servlet. > Tomcat only makes available definitions. Oh well, > that's Tomcat... > > Paul works fine for me. One common mistake known to cause problems is having an init method that fails to call super.init(). -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: calling a pre-loaded servlet from html gives Eorror:404
[EMAIL PROTECTED] wrote: > > All, > > I am trying to invoke a preloaded servlet from a .html page with Tomcat 3.1. > For some reason I am getting the Error :404 /servlet/MyServlet. Does anyone > know why. The servlet is pre-loaded...? Thanks in advance, David. > > Here is my for tag: > > > > Here is my context definitions: > > > MyServlet > > > com.web.MyServlet > > > 5 > > > > > MyServlet > > > /servlet/PInfranetServlet Shouldn't your form be using this URL that you mapped the servlet to? > > -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: Loading applet from a subdirectory of WEB-INF
Zsolt Koppany wrote: > > Hi, > > I try to load an Applet from a sub directory of > "cv/WEB-INF/classes/cv/applets". The name of the applet I try to load is > "cv.applets.GraphApplet.class". I always get the error 404. Tomcat > displays me even the correct absolute path of the applet file that I try > to load but it is not successful. I have the impression that it is not > allowed to load a class file from a sub directory of WEB-INF. How could > I configure tomcat that it can load applets from that directory or what > would be the best solution for my problem? > You must realize that applet classes are loaded just like other web browser resources such as image files. They are loaded by normal web server processes that don't have a thing to do with your servlet. Therefore they must reside in a directory that the web server can serve files from. Your impression is correct, the API specifically forbids serving classes from WEB-INF. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: Loading applet from a subdirectory of WEB-INF
I don't have any easy solution for this problem. In order for the applet to load the classes the normal way, they will have to be somewhere besides WEB-INF. I suppose you could have the applet tag codebase or archive attribute point to a servlet and have the servlet serve up the classes from anywhere. Zsolt Koppany wrote: > > Hi William, > > my problem is that the applet and some servlets use the same bean > classes. When the applet is loaded and it refers to bean classes the > location of the loaded applet is used to search for the bean classes > thus the applest must reside in a directory that the bean classes can be > found. Any ideas what I could do? > > Zsolt > > William Brogden wrote: > > > > Zsolt Koppany wrote: > > > > > > Hi, > > > > > > I try to load an Applet from a sub directory of > > > "cv/WEB-INF/classes/cv/applets". The name of the applet I try to load is > > > "cv.applets.GraphApplet.class". I always get the error 404. Tomcat > > > displays me even the correct absolute path of the applet file that I try > > > to load but it is not successful. I have the impression that it is not > > > allowed to load a class file from a sub directory of WEB-INF. How could > > > I configure tomcat that it can load applets from that directory or what > > > would be the best solution for my problem? > > > > > > > You must realize that applet classes are loaded just like > > other web browser resources such as image files. They are > > loaded by normal web server processes that don't have a > > thing to do with your servlet. Therefore they must reside > > in a directory that the web server can serve files from. > > Your impression is correct, the API specifically forbids > > serving classes from WEB-INF. > > > > -- > > WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. > > Java Programmer Certification information and mock exam > > at http://www.lanw.com/java/javacert/ > > -- > Zsolt Koppany > Intland GmbH www.intland.com > Schulze-Delitzsch-Strasse 16 > D-70565 Stuttgart > Tel: +49-711-7871080 Fax: +49-711-7871017 -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: AW: redirect problems?
ok wrote: > > yeah, I have returns, why does this do this, there is no documentation in the > JSP spec saying i have to do returns after a redirect. Is this a bug in tomcat? > The docs for javax.servlet.http.HttpServletResponse.sendRedirect States: "After using this method the response should be considered to be committed and should not be written to." -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: (Possible VIRUS) Re: ???????? - ????????????
Crashed my Netscape 4.61 but I don't think it was a virus, just some really weird data. -- WBB
Re: Problems in Installing
> Ajay wrote: > > Hello, > I am running a windows98 in a win32 platform. As u have mentioned i > unzipped the folder and renamed the folder to tomcat..Also i set the > required env variables.. > 1. set TOMCAT_HOME=c:\tomcat > 2.set JAVA_HOME=c:/jdk1.2 > 3. set PATH=%PATH%;%JAVA_HOME%\bin > I restarted the machine after this and when i run the startup.bat > tomcat doesnt run, saying "Out of Environment Space". > Please advise. > regards > Ajay Due to the large environment variables that Tomcat startup sets you will have to modify the properties of the MSDOS prompt window. Right click in the upper left corner of a MSDOS window, get the properties dialog -> memory tab Increase the initial memory allocation to 4096 -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: jar placement (clarification needed)
Mike Haberman wrote: > > There was a thread a while back about where to place > application specific jar files. I read the thread but > the solution has not worked. > > I have a jar file (myApp.jar) > > I have tomcat 3.2 running > > I place myApp.jar in $TOMCAT_HOME/lib it works! >(but I don't want it to live there) > > I place myApp.jar in webapps/myApp/WEB-INF/classes >(it does not work unjarred or jarred) > > I place myApp.jar in webapps/myApp/WEB-INF/lib >(it does not work unjarred or jarred) When you tried this, had you created a context named myApp in the server.xml file? It is that context that associates jar files in webapps/myApp/WEB-INF/lib with the deployment descriptor in webapps/myApp/WEB-INF/web.xml -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: EXE File/ port #
Ajayan wrote: > > I have JWSDK server running in this port and not TOMCAT; like I > mentioned earlier, I am not sure whether I successfully installed the > TOMCAT or not ... If any of those JWSDK jar files are hanging around on your classpath you will get a lot of very hard to interpret errors about classes or methods not found. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: web.xml, is that also a standard for other server, wich support servlets?
[EMAIL PROTECTED] wrote: > > web.xml, is that only for the tomcat-server, or ist that a standard for all > servers, wich support servlets? > > Katrin Seiffert The web.xml file requirements are laid out in detail in the servlet 2.2 API documentation. A web.xml must follow the Sun DTD for web application deployment descriptors. Any server must follow it in order to meet the 2.2 standard. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: Where to put my own class after combined with apache?
comman wrote: > > Here is my problem! > > org.apache.jasper.JasperException: Unable to compile class for >JSP/usr/local/jakarta-tomcat/work/localhost_8080/_0002fnew_0002fcn_0002fclients_0002fclients_0002ejspclients_jsp_0.java:92: > Class n_00025w.cn.clients.Replace not found in type declaration. > Replace myReplace = null; > ^ > > By the way , I using the bean as follow: > That may be your problem - class= MUST give the complete package and class due to the way Tomcat does the instantiation. -- WBB - [EMAIL PROTECTED] Chief Scientist, LANWrights, Inc. Java Programmer Certification information and mock exam at http://www.lanw.com/java/javacert/
Re: init being called twice
David Oxley wrote: > > Does anyone know why the init method is being called twice. I'm using > tomcat3.2b6 with IIS5 on W2K linked with isapi_redirect.dll. I have also > seen this with 3.1 with apache 1.3.12 on Solaris 7 linked with mod_jserv.so. > > I can code around this so that the second time through it doesn't call my > init stuff again, but surely this is a bug?! > > Any comments? > Dave > [EMAIL PROTECTED] Seems to me I recall that being traced to having a servlet entry in both the base web.xml and application context web.xml. -- WBB
Re: Session Close
Pablo Trujillo wrote: > > I need to execute a procedure when a session closes. Is this possible? How > it is made? Make a class that is a HttpSessionBindingListener - attach an object of this class to the session. When the session is destroyed your object will get a call to the valueUnbound method. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Session Close
[EMAIL PROTECTED] wrote: > > On Wed, 8 Nov 2000, William Brogden wrote: > > > > > > > Pablo Trujillo wrote: > > > > > > I need to execute a procedure when a session closes. Is this possible? How > > > it is made? > > > > Make a class that is a HttpSessionBindingListener - attach an > > object of this class to the session. When the session is destroyed > > your object will get a call to the valueUnbound method. > > this is the clean way of doing it. > you could also add some object to the session, > and do whatever you want in the finalizer. > > Dirty, but works. > > Sloot. The problems there are that 1) you don't have any guarantee as to when the finalizer will run. 2) if there is another reference to that object hanging around, it will never run. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Class file locations for use with JSPs
"Desaulniers, Peter" wrote: > > Hello there, > > I am using tomcat 3.0 to serve up an application that starts with a servlet > and then get forwarded to a jsp page for the response. The relevent > directory structure looks like this (no surprises here, I think): > > C:\jakarta-tomcat > + > +-- webapps > + > +-- myApp > + > +-- jsp > + > +-- Web-inf > + > +-- classes > > The jsp file, myJSP.jsp, is in the jsp directory. > The servlet, myServlet.class is in the classes directory. > The Worker class (this is the problem I will be getting to), Worker.class, > is also in the classes directory. > > To fire this off, I use some mappings but essentially this is how it goes: > > http://myHost/stuff/moreStuff/Command/Data > > The mappings get resolved to calling myServlet. myServlet, imports, > instantiates and calls methods in Worker. That works great! Then if > forwards the request to the jsp. Again that works great. > > Now for the problem. I have <%@ page import="Worker.*" %> and its happy > with that. However, when I try to do <% Worker w = new Worker(); %> the jsp > compilation fails with: > > org.apache.jasper.JasperException: Unable to compile class for > JSPF:\jakarta-tomcat\work\localhost_8080%2Fdscgi\_0002fdscommands_0002fmyJSP > _0002ejspmyJSP_jsp_1.java:77: Class jsp.Worker not found. > Worker w = new Worker(); Jasper is making an assumption that Worker is in the default directory. You should give a complete package and path in the variable declaration and creation statement. Is the package really named Worker? WBB
Re: problem in starting server
arvind aggarwal wrote: > > Hi, > > I have a problem in starting the jakarta-tomcat server for servlet and JSP. > when I execute startup file it give me this error: > > java.lang.ClassNotFoundException: > org/apache/tomcat/service/http/HttpConnectionHandler > That sounds like a problem that I eventually traced down to an old JAR file left over from the Sun JSDK which Java was still seeing. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: aaargh..
Alexander ten Bruggencate wrote: > > for the past 3 days i've been trying to get a jsp to work with an ejb of > mine. > the only problem is that and /> won't work. > > tomcat reports: org.apache.jasper.JasperException: Attempted a bean > operation on a null object. > at > >org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty(JspRuntimeLibrary.java:427) > > part of the jsp file: > <% > nl.step.stepdb.person.interfaces.Person p; > p = pbrowse.createUser(); > %> > > now I KNOW that the creation of the person is succesfull because it > turns up in the datatbase. > so what's wrong here? > > i use jboss-2.0-final with tomcat 3.2b7. > i could really use some help here... > > -Alexander. In your useBean tag, did you give the complete package when naming the class? If you just give the class, the bean will not be created. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: One user -> 2 parallel threads
Undoubtedly the user clicked twice on the button or link and actually created two requests. Till Gartner wrote: > > Hi mail list, > > we encounter the following problem with Tomcat. From time to time a browser > request seems to be handled by two threads from tomcat in parallel. Our own > log from java servlets shows entries of different threads doing the same > task for the same user, wich are just some milli secs apart. > > We are running Apache and Tomcat on Linux and configured Tomcat with: > > > value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/> > > > > > > > Any idea what the reason could be or how we could get rid of that? > > Have a nice week end, > -- Till. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: HANDLER THREAD PROBLEM: Stream closed prematurely
Does your client close the stream that writes the request or just flush it? I seem to recall having a problem similar to this where the solution was to not close the client's output stream until after the complete transaction. Ritwick Dhar wrote: > > Hi, > > This problem is driving me nuts. I've tried debugging this, but nothing yet. > I was hoping someone on this list will have come accross this before. > > Case: I have a servlet (server) that accepts POST requests (content-type= > application/x-ofx), and sends back a OFX response. I have another servlet > (client), that opens a URL to the server, writes the request, and reads the > reponse. Simple. > > The problem is, the moment the client tries to call > 'urlConn.getInputStream()' to get an inputstream from the server, I get this > (on the server console): > > HANDLER THREAD PROBLEM: java.io.IOException: Stream closed prematurely > java.io.IOException: Stream closed prematurely > at java.lang.Throwable.(Compiled Code) > at java.lang.Exception.(Compiled Code) > at java.io.IOException.(Compiled Code) > at > org.apache.tomcat.service.connector.AJP12RequestAdapter.readNextRequest(Comp > iled Code) > at > org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection > (Compiled Code) > at org.apache.tomcat.service.TcpConnectionThread.run(Compiled Code) > at java.lang.Thread.run(Compiled Code) > > What's really driving me up the wall is that this works perfectly fine with > Both WebSphere and JRun. Is this something particular to Tomcat?? > > Thanks for all help > > Rit -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: default timeout of session object in tomcat
Joseph Wong wrote: > > Hi, > > How to set default timeout of session object in tomcat??? > > Joseph. > It is a parameter in web.xml 30, -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Cannot create bean of class
tony wrote: > > Hi, all. I created a bean class and put it at "test/WEB-INF/classes/", I call it at > a jsp file, the following meg was returned to me. can anybody tell me why?thanks in > advance. > > Error: 500 > > Location: /test/jsp/testBean.jsp > > Internal Servlet Error: > > javax.servlet.ServletException: Cannot create bean of class TestBean > at Your Bean should be in a package, and your
Re: properties
andreas ebbert wrote: > > Hi there, > does anybody know where > to put property-files for servlets > so that tomcat finds them? > I tried to place them in the > same location as the .class- > -file but that didn´t work, any > idea´s? > > regards, > andreas If you are going to open a file, you have to use a fully qualified path. Use web.xml to pass an initialization parameter to the servlet giving the absolute path to the properties file. Here is an example: saynumb.au com.JSPbook.Chap04.NumberSoundServ basepath c:\\tomcat\\webapps\\Root\\JSPbook\\Chap04\\sounds -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: properties
Jon Skeet wrote: > > [In web.xml] > > > c:\\tomcat\\webapps\\Root\\JSPbook\\Chap04\\sounds > > Surely those backslashes don't need to be escaped, do they? XML doesn't > care about \ and I don't believe Java itself does either. > > If this were a properties file it would be a different matter, but I'm > pretty sure you can just use > > c:\tomcat\webapps\Root\JSPbook\Chap04\sounds > > Anyone have more info? > > Jon As I recall, thats the way Java writes a String like that when you do a Properties save( stream, header) method call. -- WBB
Re: cgi-bin
Pierre Roy wrote: > > I have installed a Web search engine (namely Subject Search Server v1.1). > This software directs search requests to > http://localhost:8080/cgi-bin/SSServer.exe > Therefore there is no .class nor .jsp file to be accessed ! > If I understand you correctly, you want to be able to access that SSServer.exe program functions from a servlet or JSP. The way to do that is with the exec method in the java.lang.Runtime class. This method lets you set up environment parameters and streams to simulate the way CGI processes work. -- WBB - [EMAIL PROTECTED] Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: getServletContext return nullpointer-exception
andreas ebbert wrote: > > Hi, > I am trying to get a servlets context > with getServletContext() but all I get > is a NullPointerException. Can anybody > help me? > > greetings, > Andreas The usual reason for this is a failure to call super.init() in your servlet init method. Assuming your init is: public void init( ServletConfig config ){ super.init( config ) ; // Essential!! } -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: tomcat and internet explorer
> PerseP wrote: > > Hi, > > I have just setup tomcat 3.2 on windows 98 and i've just discovered > that when running tomcat without apache on I can see the index page of > tomcat in Netscape (port 8080) but I can't see anything with Internet > Explorer, I just get "Can't display page". > > Does tomcat need any special setting to make it run with Internet > Explorer?. > > Thank you. IE has an annoying setting in the Internet Options dialog, advanced tab, under browsing. Make sure that the option "show friendly HTTP error messages" is NOT checked. That way you might see something useful instead of "can't display page" -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: 3.X and 4.X Information
http://www.orionserver.com/ has benchmarks for JSP showing Tomcat 3.1 to be spectacularly slower than the Orion and Resin servers. You will also appreciate the benchmarks showning how much faster JSP is than ASP as implemented on Microsoft's IIS > Sean wrote: > > Developers or other users ... > > I was wondering if anyone knew of any benchmarks that compare Tomcats > performance to other JSP Containers? I was also wondering if there > were any Benchmark goals for each release or is the only goal of > Tomcat to create a reference implementation? I know that Apache is > pretty much the defacto webserver (within reason) in reguard to speed > at most organizations. Is the goal of Tomcat to be the defacto JSP > Container and Servlet Runner or to be the standard reference > implementation on which others are measured? I would think the > ultimate goal is both but I don't see that outlined as a "specific" > goal on any of the sites ... they seem to only highlight it as the > reference implementation. > > Also ... is there a design documentation repository somewhere that I > can look at to see the overall design and architecture of the 3.X and > 4.X product line? > > I am interested in helping the development of Tomcat but I want to get > my head wrapped around the 1.1 and 1.2 specification as well as the > current Jakarta subprojects. I appreciate the help with these > questions and look forward to helping out in the future > > Thanks again ... > > Sean > -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: error processing web.xml
Rogelio Triviño wrote: > > Hi, everybody: > I´m using tomcat 3.2.0 in win2000, and debugging it with Jbuilder 4.0. > I´ve found that processing this for my webapp: > > > webmaster > [EMAIL PROTECTED] > The EMAIL address of the administrator to whom questions >and comments about this application should be addressed. > > directorioDescarga > c:\dev\fotos > inicializacion de directorio de upload > > only read correctly the last param, wichever be. The first one is lost > when using > webmaster = config.getServletContext().getInitParameter("webmaster"); > dirName = > config.getServletContext().getInitParameter("directorioDescarga"); > > for retreiving. > Is a bug? > Thanks. You need a separate ... tag pair for each one you set. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Servlet is not running!
Probably your problem is that browser is requesting the applet class files from the wrong place. It is using the apparent servlet address. This also interferes with loading images, sounds, etc. Put a tag in the .. region of the page you are generating. Web Master wrote: > > Hello, > > I asked this question before, if anyone answer this question ? > > I have servlet which int runs calls an applet. Everything works fine > except that, when I run, the applet is not running, it comes back and > says applet not found. > > I have a context entry for the project in the server.xml > > Do I have to do anything special to start the applet? > > Thanks in advance -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Installation Problem
Nagendra Kumar wrote: > > Sir, > While opening the startup.bat file i am getting > the message 'out of environment space'. How could i > overcome this. > > thanks, > > Nagendran > Due to the large environment parameters that Tomcat sets you need to increase the space Windows reserves. From an MS-DOS prompt window, rt-click the upper left corner, in the properties dialog. memory tab, increase the initial environment space to 4096. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Deny web-inf access (security problem)
Paul Gonin wrote: > > Hi, > > I have a JSP that uses a bean. It uses the following directory structure : > webapps/myapply/myapply.jsp > webapps/myapply/web-inf/classes/mybean.class > > It works fine but I am annoyed that people can download the bean directly > and "access" its content because it contains critical information > (passwords). > > How do I protect my bean and more generraly I'd like to protect the whole > web-inf directory (if it's possible) > > Note : I'm using Tomcat standalone. If you can actually make Tomcat deliver the mybean.class to a user, it is a serious breach of the API requirements. I am betting that you can't get Tomcat to serve anything in the WEB-INF directory to a client. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Error: 500
Naresh Chhabria wrote: > > Hi all, > I'am getting the following error when accessing this /jsp/Jdbc.jsp > > Internal Servlet Error: > org.apache.jasper.compiler.ParseException: > /var/net/services/infoline/doc/jsp/Jdbc.jsp(4,44) Attribute , has no value > > this jsp has the following code: > <%@ page language="java" import="java.io.*","java.sql.*","JdbcBean" %> > where JdbcBean is a class which has functions for database connection, > returning resultset object and closing the connection. > I think the parser is trying to tell you to only use one set of quote marks around the entire import attribute. like this "java.io.*,java.sql.*,JdbcBean" -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: jsp bean error to find class
yaya wrote: > > Hi, > I tried to connect to mysql database with bean but fail with following error > : > org.apache.jasper.JasperException: Unable to compile class for > JSP/usr/local/jakarta-tomcat-3.2.1/work/localhost_8080/_0002fjsp_0002fdataba > seselect_0002ejspdatabaseselect_jsp_0.java:64: Class jsp.DatabaseSelect not > found. > DatabaseSelect select = null; > ^ > /usr/local/jakarta-tomcat-3.2.1/work/localhost_8080/_0002fjsp_0002fdatabases > elect_0002ejspdatabaseselect_jsp_0.java:67: Class jsp.DatabaseSelect not > found. > select= (DatabaseSelect) > ^ > /usr/local/jakarta-tomcat-3.2.1/work/localhost_8080/_0002fjsp_0002fdatabases > elect_0002ejspdatabaseselect_jsp_0.java:72: Class jsp.DataBaseSelect not > found. I think the error message is trying to tell you that you have not specified what DatabaseSelect is. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: very basic web server hosting question
Horia Bochis wrote: > > Thanx, I've got it now, I understood the concept. > > Well I have to use CGI cause it is a local application and can not keep > the memory busy (as I know servlets usew to live there) and I also need a > part that needs to move fast. I have to combine them. > > What I need is to make a mixture using CGI and Servlets and what I would > like is to see those working on a windows. > > Thanx again. > > Horia Bochis You may be able to run your CGI process by exec() from your servlet. The tricky part may be setting up the environment variables that your CGI process expects. I have a simple example of executing a Perl script from a servlet in the "Connecting To Legacy Programs" chapter of my book. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Jsp Class not found
Mallik Kandula wrote: > > Hi there. > Can anybody help me why the jsp compiler is not finding my bean > class in the useBean tag of jsp ? tomcat version 3.1, linux rh 6.2. > there is no problem with the system classpath . I also have tools.jar in > the classpath and have also expanded tools.jar in ${TOMCAT_HOME}/classes > dir. > > Thanks in advance. > Mallik This is just a guess since you don't show the tag. Your useBean tag must give the complete package for the Bean, even if you import that package. This has to do with the way the Bean is instantiated by the JSP code. Your Bean must be in a package of course. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Running a thread from a JSP
"David M. Holmes" wrote: > > Is there a way to spawn a thread from a JSP that will live after the page goes out >of scope? There is nothing magic about a JSP servlet - you can certainly create objects and start Threads that will continue after the response has been sent. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2
Re: Running a thread from a JSP
"David M. Holmes" wrote: > > We have a custom tag that is in every JSP that creates a socket connection to a >target server and > POSTs some data do a page on the target server that writes the data to a database. >The issue we > are having is that we don't want to delay the user's response by doing the socket >connection > synchronously. If we do the socket connection asynchronously we risk having the data >not being > sent when the server is under stress. I have not verified that this is occuring with >the custom > tag yet, but we are seeing it happen using ASP with an HTTP component. I am pretty >sure that the > same condition will occurr. So I would like for the JSP to start a thread to do the >socket > connection, run in the background, and return the response immediately so there is >no delay to the > user. I am thinking that when the response finishes the thread that it started will >also die. Is > that correct? That should work just fine - I have done something very similar to send email. You might want to provide for logging the data to a file if the socket connection fails. When the job is done, the Thread falls out of the run method and dies - all very neat. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2