digester MissingResourceException
Hi, I'm running into a problem trying to start Tomcat 4.1.30 on my development machine (Win2000). I've downloaded and extracted the Tomcat 4.1.30 zip, placed it at C:\jakarta-tomcat-4.1.30, and set %CATALINA_HOME% to this directory. When I try to start Tomcat from either a DOS prompt using catalina run or from a Cygwin prompt using catalina.sh run, I get the same errors. I've searched both the Tomcat-User archive and Google and can't seem to find a solution to this (and adding $CATALINA_HOME/server/lib/tomcat-coyote.jar to my CLASSPATH doesn't seem to help. Can anyone suggest what I might have missed or should do to avoid the exception (stacktrace below)? Thanks, Erik $ ./catalina.sh run Using CATALINA_BASE: c:\jakarta-tomcat-4.1.30 Using CATALINA_HOME: c:\jakarta-tomcat-4.1.30 Using CATALINA_TMPDIR: c:\jakarta-tomcat-4.1.30\temp Using JAVA_HOME: c:\ibm_dev\tools\jdk\1.3.0_02 [ERROR] Digester - -Begin event threw exception java.util.MissingResourceException: Can't find bund le for base name org.apache.coyote.tomcat4.LocalStrings, locale en_USjava.util.MissingResourceExcep tion: Can't find bundle for base name org.apache.coyote.tomcat4.LocalStrings, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:707) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:670) at java.util.ResourceBundle.getBundle(ResourceBundle.java:546) at org.apache.catalina.util.StringManager.init(StringManager.java:115) at org.apache.catalina.util.StringManager.getManager(StringManager.java:260) at org.apache.coyote.tomcat4.CoyoteConnector.init(CoyoteConnector.java:274) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:253) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch( Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.start(Catalina.java:449) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Catalina.start: java.util.MissingResourceException: Can't find bundle for base name org.apache.coyot e.tomcat4.LocalStrings, locale en_US java.util.MissingResourceException: Can't find bundle for base name org.apache.coyote.tomcat4.LocalS trings, locale en_US at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.startElement(Digester.java:1276) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch( Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.start(Catalina.java:449) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
RE: how can i get a servlet instance from ServletPool
--- Edson Alves Pereira [EMAIL PROTECTED] wrote: No, i made it static `cause i couldn´t get servlet instance in another servlet, that´s solved my problem, but i´d like to know if is this the best way to solve problems like that? Doesn't it seem like you could refactor that functionality out into a non-servlet Java class and then make use of that class from both servlets? I find it helpful to think of a servlet as little more than an event handler for HTTP messages, and try to put all my real work into plain old Java objects which are then utilized by servlets (or any other place I need to use them). Erik __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: time zone
Chakradhar Tallam wrote: the machine (operating system) is in correct time zone, but when tomcat runs it shows GMT times on tomcat's console. Also if you prefer to have your Tomcat synchronized to GMT, I think this works (untested): DateFormat df = DateFormat.getTimeInstance(); df.setTimeZone(yourTimeZone); ((SimpleDateFormat)df).applyPattern(your formatting goes here); Date myDate = new Date(); // or use GregorianCalendar String output = df.format(myDate); Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
work dir
I just noticed that there are older *.java and *.class files in my hosts's $CATALINA_HOME/work/ directory, that I have long since removed from my webapp directory (and there have been a number of stops and starts of both my webapp and Tomcat itself since then). When do these files get cleared out? Or, rather, is there a document that discusses the work directory a bit more? Thanks, Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: work dir
John Turner wrote: I don't think Tomcat clears out the work directory on its own. I've always had to write wrapper scripts for my instances that do a rm -rf work/* right before a call to startup.sh. Oh okay, I didn't realize that's how it's supposed to work. No problem. I also just noticed that the contents of the work directory are owned by root, and I'm just a user on my friend's Linux server. I'll just let him know that if ever feels that the directory is getting too big he can clean it out, or modify startup.sh to do so. Is it safe to assume that anything in $CATALINA_HOME/work will be rebuilt by Tomcat (assuming the webapp starts normally and the current JSPs are still present in the webapp's docroot)? It's less trouble for him if he just has to delete one directory ($CATALINA_HOME/work) instead of doing a separate delete for every webapp. Thanks, Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: work dir
John Turner wrote: I wouldn't delete work itself...that will probably break things. My scripts just have: rm -rf /usr/local/tomcat/work/* on stop. That way, a startup is clean. Tomcat will rebuild anything it needs to build under work. That will slow things down the first time through, however, as the cache is rebuilt. If you have to stop/start Tomcat often, there's probably something else wrong that should be investigated and resolved. Thanks John. We have only had to restart Tomcat when adding a JAR to $CATALINA_HOME/common/lib and when we created my webapp. I will suggest to my admin that the stop script be modified thusly. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: server-side redirects in web.xml
I'm sure this is a FAQ, but I can't find a good example of this - I would like to do a server-side redirect on a per-application basis ( e.g. the web.xml ). Basically, I just want : http://server/url/ To be redirected to : http://server/ It needs to be transparent to the user, they should just see http://server/url/index.jsp When in reality they are hitting http://server/index.jsp; You can always fudge it by manipulating the URL with JavaScript/frames. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Guidelines on application development
Greg Speechley wrote: During development we use a java editor eg jGrasp to edit .java files which are stored in $CATALINA_HOME\webapps\app\WEB-INF\classes and compile these individually. It gets a bit tiresome restarting tomcat after each recompile but I can live with that (I have reloadable=true but this doesn't seem to be reliable). Obviously this is a fairly poor way to do things so I am keen to use the manager in 4.1.24 to reload apps and ant to build it. I have looked at the docs and created the directory structure as suggested in the Application Developer's guide (java files in src\WEB-INF\classes, etc) and can build from src directory so that class files are stored in the build\WEB-INF\classes. BTW this dir structure should be stored in folder called projectname somewhere other than $CATALINA_HOME\webapps? Now from what I can tell I would then have to move these class files to $CATALINA_HOME\webapps\app\WEB-INF\classes to be able to test it, surely I am missing something because this seems to be quite laborious. Do you use ant each time you recompile during development or just compile from your editor? If anyone can provide some suggestions on the recommended way to do things I would greatly appreciate it coz I am trying to implement much better development practices :) I think ant is pretty great. Although compiling a class from my IDE is fine for just messing around or during initial scratchwork, once I have an ant file built I *never* perform any compiling, copying, or deployment without it. Every time I add new code I run ant, which puts the code through unit tests before determining whether or not it should go to deployment. And with a simple property change, I can have the app compiled into a JAR/WAR instead. I have read only a handful of the chapters in Java Development With Ant by Hatcher and Loughran, and I have already learned tons of great tips for using ant, such as conditional compilation (so that I don't have to redeploy the -entire- app if I just want to make a small change to an auxillary package, etc), generating unit test reports in nice HTML files, and overall fine-tuning the build process. Note also that I am using ant quite happily for my non-webapp Java project as well. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: db resource mgmt
On pre-4.1 version of Tomcat it is called Tyrex. Erik Filip Hanik wrote: yes there is, a common module called dbcp search the archives Filip -Original Message- From: Chris Shen [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 5:12 PM To: [EMAIL PROTECTED] Subject: db resource mgmt is there some sort of connection pooling mechanism built into Tomcat? i was looking over the sample server.xml, and it seems that you can specify db resources. i am just wondering if tomcat actually manages some sort of db connection pooling or is that something we have to implement on our own. thanks. _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT Dumb JavaScript question
Collins, Jim wrote: Hi Guys, This is probably a dumb question, does anyone know if is possible to use JavaScript objects from a servlet? When a user makes some selections I want to add objects to an associative array I would then like to be able to access this associative array and save the values to a database from a servlet. There really isn't a simple way to do this, since for the user-agent to communicate with the servlet, an HTTP request must be submitted (containing the POST or GET data you wish to say). You can use JavaScript to create an array of information and then communicate this to the servlet with the submission of a form etc, but you will have to protect (encode) the JavaScript data in such fashion as to 1. survive the HTTP transmission 2. be understood by the servlet I am not sure if JavaScript has built-in serialization to do this. I think it would be easiest to assemble a simple URL-encoded string of data that is then URL-decoded by the servlet and parsed to extract the information. You may wish to investigate using an applet, since an applet can provide the same dynamic interface as JavaScript in addition to being able to speak natively to the servlet. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. What is the stack trace? Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I have found that debugging JSPs is a pain in the ass. If you can refactor this code to a servlet or even just some external Java objects (hint: you can then access the data from the JSP using JavaBeans), you can keep your JSP cleaner, which means less debugging of JSPs. I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). It is helpful to have this so you can specify context- and servlet- parameters as well as to perform servlet mappings. But I suppose if your app uses only JSPs it is not necessary? (Not sure.) If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Sure, there is one at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/web.xml.txt Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conflict between servlets and JSP: urgent!
Sandra Patricia Hunter wrote: I built my jsp files and they ran just fine. Then I created a servlet that runs just fine as well. But when I try to now run my jsp Tomcat continues to refer to files that are only relevant for the servlet. Even plain html pages don't run correctly. Servlets still run fine. Please help! [...] Web.xml snippet: servlet servlet-nameIDLogin/servlet-name description this is the login page for the servlet /description servlet-classidcard.IDLogin/servlet-class /servlet servlet-mapping servlet-nameIDLogin/servlet-name url-pattern/*/url-pattern /servlet-mapping Looks like you've mapped all requests within the idcard webapp to that servlet. This means that the IDLogin servlet will be called by *any* request made within your webapp's reach. Change the url-pattern element to something like /login or something. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Threads in Servlet2.3 container
klute wrote: Interesting.. What about the following scenario: say you have a base servlet that implements some interface for your app. it has validate() and forward() methods which encapsulates some logic used by all servlets in your app. doGet() and doPost() are different though. so, say my servlet A extends MyBaseServlet... here are my questions: 1) is it a good idea at all: design your servlet-based app by introducing a new hierarchy within a servlet api. 2) are there any thread safety issues that could be introduced by this since MyBaseServlet will be instantiated with every request as well? (note, validate() returns a boolean. no class level variables within any of the servlets (base or derived) are used) I'm not sure I entirely understand what you're asking, but it sounds like you're saying all of your implementation servlets will be extending a single class MyBaseServlet. If this is the case, then the answer to your second question is: there are no additional thread safety issues introduced beyond any thread safety issues that you would have to consider in the first place. Remember, the implementation servlets would be instances of MyBaseServlet; they are not instantiating a separate MyBaseServlet each time they are called. To answer your first question, I wouldn't be the judge of what is good design and what isn't because I am a novice. But one thing I am coming to realize is that in OO design, you often want your subclasses to implement some interface defined by your parent class rather than give each subclass a handful of new methods because they are just an extended version of the parent class. I used to think that subclassing was a great way to add new methods and functionality to my existing classes. I think in some cases this is fine. But usually this is indicative of the fact that the subclass is not really an instance of the parent class, but something else entirely, and perhaps in this case *composing* the parent class rather than *extending* it is the appropriate design to use. You really only want to use inheritance when you need to refer to the subclass as an instance of the parent class. Otherwise you should probably just refactor out the functionality into helper class delegates. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Registering Servlets
Sandra Patricia Hunter wrote: [...] I am creating a passwordFile using a FileOutputStream to the address above like this: String passwordFile = C:\\SANDRA\\BC Transit\\IDCardProject\\Passwords\\passwords.properties; FileOutputStream out = new FileOutputStream(passwordFile); However when I call it like this: passwordFile = config.getInitParameter(passwordFile); passwords = new Properties(); passwords.load(new FileInputStream(passwordFile)); The above web.xml does not do the trick. I believe my param-name is correct, but what should the value be? You have to stop and then start Tomcat when you want the web.xml to be re-read. Also, you didn't mention the error or problem you're getting? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Registering Servlets
Sandra Patricia Hunter wrote: What happens is that when I enter what should be correct username/password pairs they are not recognized. The value above for the name passwordFile is not correct so I do not see the page as I should. Does that help? Sort of. I mean, I understood the nature of the problem, but wasn't sure if you were getting an exception or compiler error. Are you sure that it's a matter of reading the init-param? I'd try printing out the value of that init-param from your servlet with code similar to this in doGet(): String name = passwordFile; String value = this.getServletConfig( ).getInitParameter(name); PrintWriter out = resp.getWriter(); out.println(h1The value of + name + is + value + /h1); This will tell you whether or not it's a problem with your web.xml file or if it's your bidness logic. Also, not sure if you fully stopped and started Tomcat... Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Registering Servlets
Sandra Patricia Hunter wrote: Well, it's printing out the value I assign in the web.xml file. Still it is not recognizing the user/password pairs. I think that I don't have the correct value but I don't know what correct would be? I am using the code from Marty Hall's core servlets book called protectedPage, and it should be straightforward but not. What chapter? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Registering Servlets
Sandra Patricia Hunter wrote: Four Yep, I ended up finding it (http://pdf.coreservlets.com/) -- I agree with Justin that it's probably the way you're specifying your file path. Remember that even on Windows, it's easier to use Unix-style file paths in Java. (Think of it as writing your code not for Windows but for the Java virtual machine.) Try changing it as he suggests and see if that makes the difference. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: request parameter question ...
Mufaddal Khumri wrote: if(str.equals(xyz) == true) { str = ChangedName; request.setParameter(name, str); // - how do i do this ??? There is no method as request.setParameter() } [...] one way to do it would be to append the parameter and its changed value to the path: String path = /SomeJSP.jsp?name=str; But is there some method like setParameter to do what I want to do ? You are looking for ServletRequest.setAttribute(): http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: request parameter question ...
Mufaddal Khumri wrote: Hi , I tried using request.setAttribute(name, newName); try { String path = /SomeJSP.jsp getServletConfig().getServletContext().getRequestDispatcher(path).forwar d(request, response); } catch(Exception ex) { ex.printStackTrace(); } When i do a request.getParameter in my JSP page .. it returns a blank sting . This is the reason I thought maybe request.setAttribute is not the method I should be using. Do you have any clues as to why this might be happening ? What happens if you try request.getAttribute() ? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: request parameter question ...
Mufaddal Khumri wrote: I guess if i use setAttribute ... i have to use getAttribute ... thats the reason i get the blank string .. coz i was using getParameter my problem is that the jsp uses getParameter ... it would have been good if i could have used the same method regardless as how the parameter was set. There is a difference between the two methods, if you examine closely (at first they seem to be the same). The [newer] *Attribute methods return Object whereas the [older] *Parameter methods return String. You can see why the *Attribute methods are more flexible. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Contract Work Hourly Rates
Micael wrote: I have a job offer to do contract work coding websites. I am well versed in most of the areas required, and wonder what is a good hourly rate to ask for? I know Java (certified programmer), Tomcat, Struts, Ant, blah, blah, as well as scripting, Red Hat, etc. Thanks for any assistance. What country/city do you live in? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Servlet process issue
Tam, Michael wrote: However, my concern was under the same request, if a client make a request to (A), which passes to(B) and (B) passes to (C) and so on, then a client could terminate the process by quitting the browser or stop the browser am I correct? If so, my question would be how to avoid the client to interfere the process after (A) is completed [If (A) is terminate before it is complete, then the entire process should terminate and it is ok]? If (A) is completed, then you should be fine since the request is complete and the client has no more input on the matter of what happens to the data sent in the request. If (A) is not completed, you may be left with a servlet in an invalid state (i.e. it has some information needed to perform its processing but not other information). You may need to write some code into your servlet to assure yourself that it does not try to call other Java code using incomplete information, such as some kind of validation. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Servlet process issue
Tam, Michael wrote: Hi all, Sorry for the [OT]. Since many of you are the experts on servlet technology, I'd like to ask for suggestions or comments on the servlet process I am working on. Process: 1) I have a form html (A) to upload data files through an UploadServlet (B) which stores the files in the file system. 2) Then (B) will forward the request to ValidationServlet (C) which reads the files for validation and generates log file. 3) Then (C) will forward the request to LoadServlet (D) which use the log file to load the clean data to DB. A servlet is a highly specialized kind of object that is specifically designed to receive, process, and respond to requests. In the case of HttpServlets, this would be HTTP requests. It seems that unless your ValidationServlet and LoadServlet are ever going to be directly accessed with HTTP requests, they're probably better off being written as regular Java classes (like Validator and Loader). I do not know anything about the overhead incurred by making them servlets, but it just seems that by subclassing HttpServlet for these objects, at least for the use case you've described, you're inheriting a lot more functionality than you'd ever need. This will also simplify the design question you're asking -- you don't have to backtrack anywhere, your UploadServlet can just do whatever it is you want to be done when the request processing is finished (dispatch to a JSP saying thank you?). Note that when your HTTP request is sent to UploadServlet, UploadServlet /is/ a new thread, so the user should not be able to interfere with this process. If the user tries clicking Submit again, a totally new UploadServlet will respond. If you wish to disable this ability, there is a technique involving the setting of a flag in the user's session that prevents any further requests being received until the processing is done. But you have to implement this yourself. The whole technique is detailed at http://developer.java.sun.com/developer/EJTechTips/2003/tt0114.html#2 HTH, Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: User Interface To Tomcat User List
Having this resource available as a mailing list makes it better-accessible in the long run to the most people. Unlike an eforum or ecommunity, there is a standard storage format for all of the posts made to this list, which can be programmatically accessed and parsed by many email-specific libraries in many different programming languages. There is also an advanced suite of commands available by sending mail to [EMAIL PROTECTED] for human-based access to the information contained in this list. (For instance, did you know that you can send a string to the mailing list manager and have it return you a collection of all messages whose subject matches that string? This is one way that you can be sure to keep track of a thread without actually having to be subscribed to the list.) As has been mentioned before, you can make use of the (searchable) archives if you wish to browse the contents of the mailing list without subscribing. I do this all the time from home, where I am not subscribed to the list. You can make use of filters to help keep your Inbox from being cluttered. The Jakarta mailing lists all provide the List-Id header, and I find this is a reliable way to make sure that Tomcat mail goes into the Tomcat folder of my mail client. Further filters can help you focus on the content that you wish to read, for instance I filter out any email with mod_jk or IIS in the subject because I am not currently interested in those topics. No one should subscribe to mailing lists without using mail client software with filtering features (and if this is you, Mozilla is a robust and powerful mail client that supports all the latest doodads like IMAP and IIRC Bayesian spam filtering, etc). The list is available in digest form if you really can't handle multiple emails, and I have found the digest to be extremely well-designed (making use of multipart MIME messages for intelligent mail clients that know how to display this). Send an email to [EMAIL PROTECTED] to get more information about this and other advanced mailing list features. That said, if you really want to push for a change, this isn't the appropriate forum for it -- the Jakarta Project has a General mailing list at the bottom of this page http://jakarta.apache.org/site/mail2.html where such discussions are held. Erik NormW wrote: Good afternoon All. Only new to the Tomcat User Mail List and may likely opt out soon to conserve my Inbox, but wanted to say that getting 91 emails in one session (2 were relevant to the question I asked) isn't helping me or likely of much use to anyone else for that matter either. (Perhaps my ISP who charges by the amount downloaded?) I have limited exposure to Tomcat and the docs and config files to some extent, so I probably could help a few, but not if I have to keep clearing my my Inbox every hour or so. Newsgroups are what I got used to for Netware, with the various products broken up into different categories like install, utils and so on, that ANYONE can browse, and if you see a message that you can offer some help to, just click on 'reply to group', say your piece and send; no cluttered Inboxes and, I suspect, a lot less traffic for the server. A moderator (unknown) vets/removes anything of a stupid/antisocial nature, and in five plus years that I've experienced it, it seems to have worked well. I've received emails recently that are proposing eForum(s), and, while the format is unknown to me, believe there is a sound basis for looking at changing the way the users list works, regardless of the method used. $0.02 Norm - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Netscape navigator
Susan Hoddinott wrote: Does anyone know if there is a problem using Netscape Navigator with servlet pages generating their own html using the println function. Whenever I attempt to access servlets of this kind (which work fine under Explorer) I just get the HTML text (e.g. HTML etc.) displayed on the screen rather than what should be generated. Is there something special I need to do? Did you use this? http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletResponse.html#setContentType(java.lang.String) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: User Interface To Tomcat User List
NormW wrote: While pulling down particular threads is feasible, my knowledge isn't that 'compartmentalised'; I might know 4 facts on advanced config and 100 on where to find docs; AIX, Linux, Solaris, Windows 2K, etc I can provide a cup of coffee for. Oh, what I meant was that an option would be to post a message to the list and then later in the day you could execute this command and feed it the subject you used when you posted your message to see all of the replies. This would spare you the traffic of the list but let you post and read messages. But I'm not entirely sure how the list is configured (as to whether or not you can post a message without being subscribed). And of course, if everyone /did/ do this, there wouldn't be much of a discussion on this list. ;) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extending HttpServletRequest / HttpServletResponse ???
Gavin, Rick wrote: I'd recommend getting a Serlvet programming book and optionally a JSP book. They will come in very handy for these questions. really? I have one of each, neither mention the subject or either classes mentioned. Maybe before you make a vague suggestion like get a book , you may want to qualify about whether or not the desired result is possible and suggest an appropriate resource that may actually contain said information( book title, etc,). Its always nice to try something a little different and be demoted to idiot status with the statment , get a book Does anyone have an useful information The book that I learned servlet programming from didn't talk about Filters either, because they are relatively new and the book (http://coreservlets.com/) was published a couple of years ago. You can learn more about them in a newer book, in the servlet specification (http://java.sun.com/products/servlet/download.html), or in an article (http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html). Reading that article in conjunction with the spec made it really easy to understand what they are and how they work. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Model View Controller with JSP
Jan Behrens wrote: hi list, i am trying to figure out a way to use the model-view-controller paradigm to dynamicaly reload a jsp page when the underlying object has been changed by another user. i would like to achive this without having to use a separate servlet however... any ideas, tips or links would be very much appreciated There's no way for the HTML stream that has been sent by the server to the user agent to know when something has happened on the server side without the user-agent being prompted to re-check the server. However, you can keep an open connection to the user-agent and send it new data when necessary -- it is complicated but someone recently posted a link to this article on the subject (this is called pushlets): http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet.html Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Server.xml
Hunter, Sandra wrote: Frustration abounds: I am plodding through a tomcat tutorial and it suggests modifying the Server.xml file to include a new context path line to allow for playing with a sample file. Everything works tickety boo until I do that, then Tomcat won't startup at all. When I enter the startup command I just get a really brief flash of screen and poof! It's gone again. When I take the new line out of the server.xml file the problem persists: poof! Gone. That is the only change I make. Any thoughts? Check in your logs directory. $CATALINA_HOME/logs or %CATALINA_HOME%\logs Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Server.xml
Hm... I don't seem to know enough about it to help you. But hopefully this should be enough for someone else. Additionally you might wish to post the few lines before and immediately after the change you made, as well as the change itself, in your server.xml file. Note that it should be spelled server.xml (lowercase s). Erik Hunter, Sandra wrote: Erik: This is what the localhost log says: 2003-03-17 13:04:44 StandardContext[/star]: Starting 2003-03-17 13:04:44 StandardContext[/star]: Processing start(), current available=false 2003-03-17 13:04:44 StandardContext[/star]: Configuring default Resources And the apache log: 2003-03-17 12:52:49 [org.apache.catalina.connector.warp.WarpConnector] Error accepting requests java.net.SocketException: socket closed at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:343) at java.net.ServerSocket.implAccept(ServerSocket.java:438) at java.net.ServerSocket.accept(ServerSocket.java:409) at org.apache.catalina.connector.warp.WarpConnector.run(WarpConnector.java:590) at java.lang.Thread.run(Thread.java:536) So does this make any sense to you? What do I do? -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED] Sent: Monday, March 17, 2003 1:03 PM To: Tomcat Users List Subject: Re: Server.xml Hunter, Sandra wrote: Frustration abounds: I am plodding through a tomcat tutorial and it suggests modifying the Server.xml file to include a new context path line to allow for playing with a sample file. Everything works tickety boo until I do that, then Tomcat won't startup at all. When I enter the startup command I just get a really brief flash of screen and poof! It's gone again. When I take the new line out of the server.xml file the problem persists: poof! Gone. That is the only change I make. Any thoughts? Check in your logs directory. $CATALINA_HOME/logs or %CATALINA_HOME%\logs Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange Tomcat Admin Tool behavior
Doug Selph wrote: I had checked for this case with an earlier error, but neglected to do so with the symptom reported below until today. Shame on me. Found a reference in Google that seemed to point to an invalid session as the cause. Browser was the beta of Apple's Safari. I have seen a problem with using Safari to browse some sites that use cookies for session tracking (linuxtoday.com is one such case where I could not browse as anyone but an anonymous user), while others seem to do fine with Safari and cookies. At any rate, I subsequently tried both Camino (mozilla port on OS-X) and IE/Mac, and the administration tool worked as expected under both. Yes, I like Safari but wouldn't use it as the client in any production-level workflow. It's not ready yet. The only really stable OS X browser IMHO is Mozilla (even IE5/Mac has shoddy SSL support, though I think it's otherwise respectable). ERik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Mailing List
Chris Dodunski wrote: Wow, my first day on the Tomcat mailing list, and arrived at work this morning to find around 100 emails in my INBOX! What this community perhaps needs is an eForum - or is there one already? Mailing lists are fine for small eCommunities, but not for eContinents. :-) Two options: 1. You can get the digest version -- it's not advertised on the site but if you query the ezmlm server for help it tells you about it: [EMAIL PROTECTED] 2. Not sure what an eForum is but you can use the Mail Archive to read the list from a browser (but not post, obviously): http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/ Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTTP 500-Internal Server Error
pcampaigne wrote: Thanks Matt. I had my servlets in the src directory under WEB-INF so I creates a classes directory under WEB-INF and moved them there. However, I still get a 500 error but the root cause is different: NoClassDefinitionFoundError: com/op/test/LoginServlet (wrong name: LoginServlet) It seems to me that the web.xml entry should resolve this. I still don't get it. Your directory hierarchy should look something like this, where each item followed by a slash is a directory: -webappname/ -any JSP or HTML files you are using are probably here -WEB-INF/ -lib/ -any JAR files you are using go here -classes/ -com/ -op/ -test/ - LoginServlet Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A question regarding accessing parameters after the ? ina URL
p niemandt wrote: As far as I know you should separate parameters with an ampersand ... Build up your query string, end this with a question mark and append your parameters with the ampersand ... ie. Something like MyFavourite.JSP?id=2path=myprojectparam1=2param2=3 etc, etc... Don't forget to use an entity ( amp; ) if you're hardcoding any of these paths into your JSPs or HTML pages, /especially/ if you're outputting XML. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: response.sendRedirect( .. )
Geoff Coffey wrote: On Wednesday, March 5, 2003, at 08:32 AM, Tim Funk wrote: I paraphrase as its nice to present some body content in your page since browsers/agents do have the option of displaying/parsing the body for some context before following the redirect. I stand corrected on that point, although I've never followed this guidance in 8 years, and I've never seen a user agent that didn't follow redirects immediately. You're probably thinking of browsers. Spiders and other scripts, on the other hand, might not be so kind, esp since you're trying to use redirect to prevent access to a restricted area. For instance, in CGI environments, after setting the Location header (equivalent of sendRedirect) it is always wise to immediately exit the script so that no further content is sent along with the header. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: response.sendRedirect( .. )
Geoff Coffey wrote: It seems like we need our authentication check and redirect (or forward) on the content page itself and not in an include, so Muffi created a taglib to encapsulate this check and that seems to be working. Is this a typical solution? It seems like a frustrating restriction to prevent redirects or forwards in includes. Does anybody know the reason for this limitation? Does anybody have a better way to accomplish what I'm describing? I know a lot of people prefer container-managed authentication, but my own approach has been similar to yours. At first I tried doing the exact same thing, which is how I would have done it in my old language, PHP. But with servlets/JSP, I think a better way to do this (that works well for me) is to write a filter and map that filter to any sensitive URLs. The filter does the authentication check, and has the ability to perform the sendRedirect with no problems (unlike a runtime JSP include using jsp:forward). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forward request to static html page loses path for included images?
Ray Tayek wrote: i was using getRequestDispatcher(). but i have changed that to use redirect (which works, but may cause me some problems later with session - not sure, but i want to have the guy stay in that same sessiosn even if goes off and looks at a static page - i am worried about people who don't allow cookies and if i don't do some kind of url encoding on the static file i may get hosed - maube i should just copy it througt the servlet?). There is a method of HttpServletResponse called encodeRedirectURL for this, so that when you redirect to another page, the session is maintained: (in the doGet method of a Servlet:) // redirect to somepage.jsp but // preserve the session in the URL: String targetPage = somepage.jsp; response.sendRedirect( response.encodeRedirectURL(targetPage)); But your suspicions are correct: if you redirect to a static page (non-JSP) at any point in your application and the user has cookies disabled, there is no way to encode the URLs on the static page to keep the user in the session. Instead of redirecting to a static HTML page, make it a JSP and encode the URLs on it. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat on WinXP
Denise Mangano wrote: I have my JAVA_HOME set to point to my c:\jdk1.4.1\bin No, that is not the home of your JDK installation. The home is the main directory -- c:\jdk1.4.1 -- so change JAVA_HOME so that it points to this directory. and export JAVA_HOME in my PATH variable. If you are running Windows, why do you use export? AFAIK that's a bash shell construct (unless you're running Cygwin to get the bash shell running on Windows, in which case none of what I'm about to say applies). The PATH environment variable simply contains a list of directories that your shell should check for executables (programs that often end in .exe). Because quite a few of the tools used by Java programmers are executables in the bin directory of the JAVA_HOME location, it is often recommended that developers add this directory to their PATH. Assuming that said developer has already defined a JAVA_HOME environment variable to point to their JDK's home directory (in your case this is c:\jdk1.4.1), all you need to do is make sure that the PATH environment variable contains one of the following: %JAVA_HOME%\bin -- for non-Cygwin Windows systems $JAVA_HOME/bin -- for unix/linux-based systems (such as Cygwin on Win32) It's like taking a shortcut instead of simply using the full path: c:\j2sdk1.4.1\bin -- for non-Cygwin Windows systems /usr/local/j2sdk1.4.1/bin -- for unix/linux-based systems Of course, it really all depends on where you installed the JDK in the first place, not every Unix system has it in /usr/local and not every Wintel box has it in c:\. I checked the error logs, and for some reason it is saying unable to find java compiler. This suggests that the javac compiler is not being found in any of the directories in your PATH environment variable. Make sure that your PATH environment variable contains the bin directory of your JAVA_HOME. I created a simple test.java in my G:\tomcat directory and tried to compile from the command prompt. I receive no error messages but the file does not compile. (When I performed the same test on my C:\ drive it compiled fine). Can someone please let me know if having the JDK on a separate partition could be causing my problem? If so then I would imagine I have to install the JDK on the same partition - but would this cause conflicts with the JDK I have installed on the C:\ drive. I don't think the partition on which the JDK is installed really matters. What's important is that your environment variable JAVA_HOME points to the location of the JDK so that tools expecting to use the JDK know where to find it, and that the java, jar, and javac tools are in one of the directories on your PATH. Adjust your PATH environment variable to make sure. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat on WinXP
Denise Mangano wrote: What boggles my mind even further is that at the command prompt I cahnge to G:\tomcat and I try javac test.java and it gives me no error messages, but no class file is compiled. Try javac -help and see if a help message appears. If it does, then javac is on your path and working correctly, and you can eliminate that as the source of your problem. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: response.sendRedirect( ); question
Mufaddal Khumri wrote: Now if the USER_AUTHORIZED attribute is not set, it will enter the if block and get redirected to the login.jsp page. The browser shows me the content of the body page after the if block instead. Does after getting redirected the call returns to this page and completes the processing of this page ? Try putting a return; statement immediately after the call to sendRedirect. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: response.sendRedirect( ); question
Mufaddal Khumri wrote: Adding a return does not work. Well, it was worth a try. Sorry it didn't work out. My own approach (modeled after the conventional wisdom tossed about on this list and in some tutorials I have read) is to refrain from using decision logic in JSPs wherever possible. Some people call it the MVC approach, I typically have a servlet as the target resource of all HTTP requests, which does the decision making and then calls dispatcher.forward() on a JSP to generate the HTML to send to the browser. I have not had any problem calling sendRedirect from a servlet. If I absolutely must have conditional logic in the JSP I try to put it into a custom tag. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat on WinXP
http://catb.org/~esr/jargon/html/entry/AFAIK.html Kenny G. Dubuisson, Jr. wrote: What is AFAIK? Sorry to ask but I see it all the time and I've not been able to figure it out (:p Kenny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jsp:forward .. / from within an included JSP file ?
Mufaddal Khumri wrote: Now, since a request.sendRedirect( .. ) wont work from within an included .jsp page ... i am trying to use the jsp:forward ... / tag. [...] Now if the USER_AUTHORIZED attribute is not set, it will enter the if block and get forwarded to the login.jsp page. I get the following error now: - Root Cause - java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:368) Be careful when using jsp:forward with unbuffered output. If you have used the page directive with buffer=none to specify that the output of your JSP page should not be buffered, and if the JSP page has any data in the out object, using jsp:forward will cause an IllegalStateException. from http://java.sun.com/products/jsp/syntax/1.2/syntaxref1212.html#15694 Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WebDav
[EMAIL PROTECTED] wrote: Hi, I am not familiar with webdav. What it, any links?? http://webdav.org/ I got the latest version of Tomcat.It is on a Linux Box. I wanted to use webdav inorder to give our developers the ability to modify files in our webapps in Tomcat w/o having to login to the box and do vi or something, w/o having to ftp files over or without having to scp files over. We all use windows boxes and I basically just wanted to do something like Webdav well they could just see a gui copy the file over edit it and copy it back. Can I do this with webdav and if so how? And if not are there any other options. One option is to set up a dedicated webDAV server which you are able to use the way you like (as a workspace and shared repository of your files), and provide an ant script which builds the webapp and ships it over to the Tomcat server. I never do any development in my Tomcat directories anymore. I find it's much easier to work on my local machine, or even in a workspace directory on the server where my Tomcat is running, and then use an ant script to (1) first build the application and (2) move the build from the local machine/workspace directory to the Tomcat directory. Using a scheme like this, you should be able to have your cake and eat it too. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing Tomcat on WinXP with Apache/PHP/mySQL setup
Denise Mangano wrote: Now I want to integrate Tomcat into the picture, and I am just wondering if there is anything special I need to do so nothing conflicts or do I proceed with the Tomcat installation as normal. Let your web server run on port 80 (the default for Apache IIRC) and let your Tomcat server run on port 8080 (the default for Tomcat). No conflicts, and you can develop to your heart's content. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Am i doing something wrong while using jsp:setProperty ... /?????
Mufaddal Khumri wrote: [...] In my JSP page i have the following code / /--- jsp:useBean id=myBean class=MyBean scope=session jsp:setProperty name=faqHelper property=dbReader value=%= session.getAttribute(DBWRITER)% / jsp:setProperty name=faqHelper property=dbWriter value=%= session.getAttribute(DBWRITER)% / /jsp:useBean / /--- I get the following error in my log file: 2003-03-03 10:23:51 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: FAQHelper In your jsp:setProperty tags, the name attribute should be the same as a JavaBean instance identified with the id attribute of jsp:useBean. So maybe it should look like this: jsp:useBean id=faqHelper class=MyBean scope=session/ jsp:setProperty name=faqHelper property=dbReader value=%= session.getAttribute(DBWRITER) %/ etc. Also you may need to downcast the value returned from session.getAttribute(). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forward request to static html page loses path for included images?
Ray Tayek wrote: hi, i am forwarding a request to a static html page that has some pictures included using IMG SRC=images/help1.jpeg ... and using request.getRequestDispatcher(/help.html).forward(request,response);. the static html file file comes back sans images. but pointing a browser to http://tayek.com:8080/feb/help.html works fine. seems like the path that the static page inherits is hosed somehow. is there some way to set that path? According to SRV.8.4 of the Servlet 2.3 spec, The Forward Method: The path elements of the request object exposed to the target servlet must reflect the path used to obtain the RequestDispatcher. The only exception to this is if the RequestDispatcher was obtained via the getNamedDispatcher method. In this case, the path elements of the request object must reflect those of the original request. I'm not sure how to interpret this exactly -- but it seems to say that the request object inherited in the target servlet (which I can only assume also applies to target HTML pages as well, since targets of the forward method can be either servlets, JSPs, or HTML pages) should match the path used to obtain the RequestDispatcher. Are you using getNamedDispatcher? If so then the request object will have the original HTTP request's path elements. If you are using getRequestDispatcher and passing it a path, then this would suggest that you are experiencing a bug in Tomcat. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WebDav
Anthony Smith wrote: I can't seem to copy jsp files from my webdav nor an I copy them to my webdav? DO you have this problem? I don't use WebDAV with my servlet/JSP development. I was just suggesting a possible way to do it. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Am i doing something wrong while using jsp:setProperty ... /?????
Mufaddal Khumri wrote: I downcasted but it did not help. jsp:useBean id=faqHelper class=FAQHelper scope=session jsp:setProperty name=faqHelper property=dbReader value=%= (Object)session.getAttribute(DBREADER)% / jsp:setProperty name=faqHelper property=dbWriter value=%= (Object)session.getAttribute(DBWRITER)% / /jsp:useBean That's not downcasting, because the getAttribute methods return their values as type Object by default. Unless you really are storing instances of Object in your session. I also noticed that your FAQHelper class is not in a package. IIRC you need to package all of your classes as of Java 1.4. Go to the FAQHelper class, use a package declaration to put it into a class, similar to this: package com.wmotion.mypackage; Now in your JSP you should use the following syntax: jsp:useBean id=faqHelper class=com.wmotion.mypackage.FAQHelper scope=session jsp:setProperty name=faqHelper property=dbReader value=%=(MySpecialSubclass) session.getAttribute(DBREADER)%/ jsp:setProperty name=faqHelper property=dbWriter value=%=(MyOtherSubclass) session.getAttribute(DBWRITER)%/ /jsp:useBean Hope that helps Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat throws exception while parsing taglib descriptor ????
Do you have an XML declaration at the top with the reference to the taglib DTD? http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPTags5.html#66396 Also, your /tag-class tag looks like it has a space in it, though that could just be from the email client. Erik Mufaddal Khumri wrote: I have the following taglib descriptor defined // __ taglib tlib-version1.0/tlib-version jsp-version1.2/jsp-version short-namecw/short-name urihttp://www.wmotion.com/tomcat/coursewizard-taglib/uri description CourseWizard tags /description tag namehyperLinkList/name tag-classcom.wavesinmotion.cw.classes.taglibs.HyperLinkList/tag- class descriptionDisplays a list as Hyper Links /description bodycontentEMPTY/bodycontent attribute namevalue/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute /tag /taglib // __ When i start tomcat ... tomcat throws the following error in the log file: SEVERE: Parse Error at line 9 column 17: Element type tlib-version must be declared. org.xml.sax.SAXParseException: Element type tlib-version must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1514) at org.apache.catalina.startup.ContextConfig.tldScanStream(ContextConfig.ja va:977) at org.apache.catalina.startup.ContextConfig.tldScanTld(ContextConfig.java: 1006) at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:870 ) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Mar 3, 2003 1:18:27 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 10 column 16: Element type jsp-version must be declared. org.xml.sax.SAXParseException: Element type jsp-version must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at
Re: tomcat throws exception while parsing taglib descriptor ????
That taglib descriptor has a tlib-version of .0 Mufaddal Khumri wrote: Yes, I do have the XML declaration. I basically am using the .tld from under the examples webapp as a template the contents of my .tld file are : ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE taglib PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd; taglib tlib-version .0/tlib-version jsp-version1.2/jsp-version short-namecw/short-name urihttp://www.wmotion.com/tomcat/coursewizard-taglib/uri description CourseWizard tags /description tag namehyperLinkList/name tag-classcom.wavesinmotion.cw.classes.taglibs.HyperLinkList/tag- class descriptionDisplays a list as Hyper Links /description bodycontentEMPTY/bodycontent attribute namevalue/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute /tag /taglib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat throws exception while parsing taglib descriptor ????
Mufaddal Khumri wrote: Sorry, abt that ... that was a typo, I do have it defined as: tlib-version 1.0/tlib-version The problem persists .. any cues ? Well, I just checked my own taglib descriptor. I'm not sure why there is a discrepancy, but mine uses the tag tlibversion and jspversion instead of their hyphenated versions. Perhaps that will work for you. Perhaps someone can shed some light on which is actually correct. I do know, however, that mine works for me on Tomcat 4.0.6 (non-hyphenated tags). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat throws exception while parsing taglib descriptor ????
Mufaddal Khumri wrote: Hi ... From the error i get ... it seems that it accepts the hyphenated version but it throws an error when it parses the tag element .. The error i get is : Mar 3, 2003 2:19:21 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 26 column 9: The content of element type tag must match (name,tag-class,tei-class?,body-content?,display-name?,small- icon?,large-icon?,description?,variable*,attribute*,example?). That error is telling you the order in you must place your elements of the tag element. This is required by the DTD. Read it carefully and you will see the problem with your taglib descriptor. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat throws exception while parsing taglib descriptor ????
Mufaddal Khumri wrote: Hi, Thanks Eric .. that was the problem .. the order ! ... the taglib documentation just said .. you need these elements .. never knew that order would matter. Thanks for your help. No problem. I had the same happen to me when I made my first taglib descriptor. I have found that although the Tomcat documentation helps explain the concepts, sometimes I encounter problems that are too detailed for the docs. I keep a PDF copy of the servlet, JSP, and J2EE specifications on hand just in case I have a more detailed issue, and it is helpful. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ejbs and sql server
Another one (might be easier to set up) is OpenEJB.org http://www.onjava.com/pub/a/onjava/2003/02/12/ejb_tomcat.html Erik Filip Hanik wrote: nope, Tomcat is a servlet/jsp engine. Take a look at www.jboss.org Filip -Original Message- From: Michael Ni [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:21 PM To: [EMAIL PROTECTED] Subject: RE: ejbs and sql server im unclear how EJBs work with tomkat. do we just put all the classfiles inside WEB-INF and they work? mike From: Tam, Michael [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: ejbs and sql server Date: Fri, 28 Feb 2003 15:01:10 -0500 Well, you should try search example online i.e. through google. EJB is a standard and should work with any DBMS (usually ;) ). Once you find an example and it should work on your choice of DBMS. -Original Message- From: Michael Ni [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 11:28 AM To: [EMAIL PROTECTED] Subject: ejbs and sql server Hi does anyone have examples of EJBs that connect to SQL Server 2000? I have different queries that i want to run but i want to make my connection and queries in a EJB so i dont have to retype it in my JSP pages every time i need it. Also does anyone have examples of JSP pages calling EJBs? mike _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Filter - ServletContext
Günter Kukies wrote: Hello, I want to read some context-param from web.xml within a filter. But the getAttribute is always null. There is no problem to get the same context-param within a Servlet. Don't you want getInitParameter() ? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Performance .. Jsp compile import wildcards
Reynir Hübner wrote: Hi, I'm wondering what kind of performance decrease (if any) it has to use wildcards in jsp import lines. example : %@ page import=java.util.* % .. but not : %@ page import=java.util.ArrayList % I know in normal java classes using wildcards when importing packages or classes does not matter at runtime, but the compile time may take longer. But JSPs are compiled, so this is still only a compile-time issue. (Unless I'm mistaken?) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Filter - ServletContext
Günter Kukies wrote: Oh, sorry getInitParameter() was the solution. Thanks for your hint. But why is the ServletContext not the same in Filter and HTTPServlet? I am confused. There is one ServletContext in a webapp (as far as I know, which isn't very far). You can access it from a Filter using getFilterConfig().getServletContext(), and you can access it from a HttpServlet using getServletContext(). It is the same. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Performance .. Jsp compile import wildcards
Reynir Hübner wrote: But JSPs are compiled, so this is still only a compile-time issue. (Unless I'm mistaken?) Erik Yup, that's true... I'm really just trying to find out how much this can slow down the compile of a jsp page (jspc). I'm guessing not much but I am no compiler specialist. Maybe this makes the compile take a lot longer and there for slow down the first execution of every jsp page, unless I use a jps precompiler. The question I am asking my self is Is this something I should take into concern when I am optimizing my web-application, or will it be a waste of time to review hundreds of jsps and fix the import lines ? Why not just precompile your JSPs upon deployment so that this is not an issue? (Even though it is only an issue the very first time the JSP is compiled anyway.) If you deploy via ant, I think there are tasks that can punch the JSP through Jasper on its way to the deployment area. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: properties files
Jose Moreira wrote: thanks :) i noticed that the servlet context isnt available also ... but if i put the properties file inside the WEB-INF/lib, what's it's path ? If the properties file is in WEB-INF/lib, then it must be in a JAR file. The technique for accessing a properties file from a JAR file is something like this (could be a little wrong): String propertyPath = jar:/path/to/jarfile.jar!/path/to/properties; InputStream in = this.getClassLoader().getResourceAsStream(propertyPath); Properties p = new Properties(); p.load(in); The problem here is that this requires you to know the absolute path to the JAR file, which I do not know if it is possible for a webapp to give you the absolute path. However, it must be possible because I believe log4j uses properties files from JAR files in webapps. So, you might want to ask around there or check the log4j source code. Please let us know what you find! Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: properties files
Erik Price wrote: However, it must be possible because I believe log4j uses properties files from JAR files in webapps. So, you might want to ask around there or check the log4j source code. Please let us know what you find! Responding to my own post, I took a look at the Log4J source and it /appears/ that Log4J does exactly what you described earlier -- it queries the class loader for the specified resource and then returns the URL of that resource. classLoader = getTCL(); if(classLoader != null) { LogLog.debug(Trying to find [+resource+] using context classloader +classLoader+.); url = classLoader.getResource(resource); if(url != null) { return url; } } The code that I am referring to is viewable at this URL: http://cvs.apache.org/viewcvs/jakarta-log4j/src/java/org/apache/log4j/helpers/Loader.java?rev=1.18content-type=text/vnd.viewcvs-markup Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: properties files
Simone Chiaretta wrote: I store properties in my the app WEB-INF/web.xml context-param param-namesmtpServer/param-name param-valuemy.smtpserver.net/param-value descriptionSMTP server to be used to send email from forms in the website/description /context-param and I access the value also in JSP pages with String value = getServletContext().getInitParameter(smtpServer); and I assure u that it works even with JSP not only with servlet, Because JSPs are servlets. but I never tryed accessing it from inside a bean. Because you can't, unless you pass the data to the bean somehow (via constructor or method arg) then it has no knowledge of the ServletContext. To the OP: just use the Properties file from the JavaBean the way you would normally in a non-webapp Java application. To be visible to the Tomcat classloader, put your Properties file in WEB-INF/classes or jar it up and put it in WEB-INF/lib. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is there a tag or some kind of mechanism that would do the following...
Mufaddal Khumri wrote: There are some cases where this is unavoidable and I was wondering if there was a way to do something like below in a .java file: public class MyServlet extends { doPost( ... ) { . . Some kind of tag that signals to the compiler that whatever follows is to be out.println(... ) If you just want to keep your doPost and doGet methods clean, why not create a static method that simply returns a giant string and then use that method in your doGet or doPost method. Doing this has its own overhead, however, since there's extra processing going on, but it's probably not that bad if you really need this convenience. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is there a tag or some kind of mechanism that would do the following...
Will Hartung wrote: Finally, I'd look at creating a simple script is any convenient language that simply converts an HTML file into java, and then cut-n-paste in into your code. Now, I find cut-n-paste to be one of the great evils of the development communiity, but sometimes it is appropriate for one-off code generation tasks. I have written a similar script in Python to generate accessor and mutator methods for beans. It comes in handy for laying down dozens of lines of getters and setters. Cut and paste from other Java code might be a mistake (not as bad as cut and paste in other languages), but code generation is code generation. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 4.1.18 session objects
Another way to track users would be to use a filter mapped to all of the relevant resources in your webapp. When the request hits the filter, the filter checks the session to find out which user is making the request (assuming that you have bound a User object to the session as you described in your post below) and logs the request with the associated User. Erik Filip Hanik wrote: sessions are designed exactly for that, tracking users. tomcat stores them for you, all you need is to store your user object in the session. Filip -Original Message- From: Greg Speechley [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 3:54 PM To: Tomcat Users List Subject: RE: Tomcat 4.1.18 session objects Hi Yoav, I was wondering why using sessions is unreliable for tracking users who are logged in, getting last accessed time, etc? I would have thought that storing all the current sessions in a Vector (or some other data structure) with a User object (storing all their relevant info) bound to each session would work well. What alternative would you suggest because the situation described by R.C.Nougain sounds very similar to what we have where I work. Cheers Greg Speechley -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, 26 February 2003 12:46 AM To: Tomcat Users List Subject: RE: Tomcat 4.1.18 session objects Howdy, Where can I find the changes list from Tomcat 4.0.x to Tomcat 4.1.x. Download any release of tomcat. Explode the distribution and you'll see a bunch of release notes files, one for each labeled release, detailing what's new in that release. | For each user session I store the reference| to the session in a Vector so that I | can tell what users are logged-in, last-accessed-time etc. It was working fine | in Tomcat 4.0.4. But in Tomcat4.1.18 (perhaps due to new specifications) session | objects are pooled (StandardSessionFactory) and hence the references I | am storing in the Vector become useless across the jsp page calls. I have a | thread that uses this Vector to clean up the users that are timedout but since | the session refs in my Vector are useless I can do nothing. Instead of | storing the refs if I store Session IDs then can I get ref to a session from | JSP Server so that I can get the attributes I have set in it. Please comment. Since you only asked for comments... There is no new specification regarding http servlet sessions from tomcat 4.0 to 4.1. It's still the servlet spec v2.3. Your design is vulnerable to any changes in the container session façade implementation. Note that the container is not required to provide you with a session list per se. I don't think using sessions to track who's logged in and last-access-time for resources is reliable. But if you want to do it that way, write an HttpSessionListener. It was created for these sort of session tracking things. Move your vector into that listener. Add a reference each time a session is created, remove it when a session is destroyed. Add whatever other functionality you need to the listener. Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping .jsp to controller servlet
Januski, Ken wrote: I've found a workaround for the time being. Each .jsp page has access to a bean that includes login info. I changed jsp page to test to see if the login flag is true. If so nothing happens. If not then I use jsp:forward to send it back to the login.jsp page. So this will work until I feel ready to explore filters. That sounds like a good solution. If and when you do explore them, there is a good article here (that helped me): http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-servletapi.html and when you're done with that, http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping .jsp to controller servlet
Januski, Ken wrote: Thanks Eric, I know that I do need to learn about filters. It's just something I don't feel like I'm up for at the moment, though I may find it surprisingly easy once I finally look into it. I'll take a look at the articles. I felt the same way until I took a closer look and realized that it's not really much different from a servlet. The concept is pretty simple actually. I know that you use JSPs in your app, not sure if you use servlets -- but if you have written a few servlets, then the Filter will be a breeze. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher and WEB-INF
rf wrote: It is strange that RequestDispatcher considers only jsp and html, why not other extns like jpg/gif or why not just any other resource - is this because of any security concern? I don't think it's security, but I looked at the Servlet spec (page 55) and couldn't find a specific reason. It looks like it was originally intended that a RequestDispatcher should represent only a servlet, and that you could forward to that servlet to continue processing the request, but there is also the include method of RequestDispatcher for when you wish to output /some/ data and then allow the included resource to continue processing. Perhaps the very fact that HTML files are allowed to be the target resources of RequestDispatchers at all was added on at some later point for developer convenience. Certainly there is more [programmatic] flexibility if you are forwarding to or including a servlet (or JSP, which is really a servlet). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping .jsp to controller servlet
I may not be entirely clear on what you're saying, but if you're saying that no one should directly be able to request your JSPs and instead they should only access the contents of your site by requesting Servlet resources (which then forward to JSPs), perhaps it would be worth moving the JSPs into WEB-INF where they cannot be touched? AFAIK, you can still have the servlets dispatcher.forward() to the JSPs if you do this. Erik Januski, Ken wrote: Yesterday I noticed that an application that has been running successfully for about a year has a problem I've never noticed before. It's set up so that all access to web-app is through a login method that calls a login.jsp page from a controller servlet. So all requests to jsp pages get redirected to the login page. But yesterday I noticed that if I included .jsp in the address the controller servlet and the login.jsp are completely bypassed and access is given to the jsp page. I've also recently changed the login method to use JCIFS and authenticate against NT domain controller rather than a mySQL database and I suppose it's possible that the problem is actually there. In investigating this though I've read that .jsp pages are public, which indicates to me that they CAN be accessed directly. Can anyone tell me if this is true. In other words is mapping .jsp to a servlet fruitless? If not then I guess I can conclude that it's the login method that is failing not the mapping. I've included this in my web.xml to force redirection of all .jsp page to the servlet but it seems to have no effect. The relevant portion of web.xml, mapped to servlet named 'sysadmin' further up in web.xml. servlet-mapping servlet-name sysadmin /servlet-name url-pattern .*jsp /url-pattern /servlet-mapping Thanks for any info, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping .jsp to controller servlet
Januski, Ken wrote: Hmm. I got a 404 error after moving one jsp file to WEB-INF and trying to directly access it. That's not great but at least it prevents access. Worse though is that when I then try to go to page after having logged in I get a root cause: file not found error. So it looks to me like you can't move your .jsp files out of the root web-app directory. Can anyone shed any more light on this? Oh, I didn't realize you were still trying to directly access the JSPs after login. I made the assumption that you were only using the forward method of RequestDispatcher to forward to those JSPs from your servlets. If you need to allow those JSPs to be directly accessed via HTTP requests, my solution won't work. Perhaps you can move them to a subfolder (not WEB-INF) and map a filter to it which only calls doFilterChain() if the user has a valid session and is logged in? If the subfolder was called /protected, you could use the URL pattern /protected/* as your filter mapping. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
configuring JNDI for App-level auth
Hi, I have an account on a server running Tomcat 4.0.6 and am finally getting around to incorporating connection pooling into my app. At first I was going to use a home-brewed connection pooling class that I read in a book, then I discovered that there is support in Tomcat for the DBCP project's implementation, but then I found out that DBCP is for Tomcat 4.1.x or later, so I suppose I will try to use 4.0.6's Tyrex connection pooling system. I am also relatively new to JNDI concepts so please go easy on me. In reading the Tomcat JNDI Resource How-To, the example provided uses res-authContainer/res-auth to indicate that the Container should sign onto the Resource Manager on behalf of the application (using parameters from $CATALINA_HOME/conf/server.xml). However, I am curious how to specify connection parameters if I wish to use Application-level authorization, rather than Container-level. Erik - To unsubscribe, e-mail: tomcat-user-unsubscribe@xx For additional commands, e-mail: tomcat-user-help@xx
Re: [OT] free Database with Transaction (Sorry for the noise)
Michael Micek wrote: chomp On Wed, Feb 19, 2003 at 08:16:25PM -0500, Jake Robb wrote: Internal and External refer to whether you compile the mySQL source into your program and distribute that (internal), or you just distribute mySQL along with your software (external). Really? Do they define that somewhere? My interpretation of the page was that internal and external referred to your organization (say, one division of your company providing software for another vs distributing to a separate company). I don't see how they would enforce that (restriction on internal distribution), though. Nor would it matter, in most cases. If dept A wants to use the budget system from dept B, and the budget system is not written for deployment outside of the company (external), then I would think that [most of the time], if dept A says Hey can we get the source code?, then dept B would probably say sure. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBC ORACLE implementation !
Chong Yu Meng wrote: As a rough indicator (and I invite others to correct me), it takes : - 1 month to understand Oracle - 2 weeks to get JDBC working the way you want Is this indicator specific to Oracle? I set up the MySQL JDBC driver and had working queries in a matter of hours. (I am not using complex database abstractions, simply submitting SQL queries with JDBC classes.) - 1 week to learn about file i/o I'm not sure about the Java tutorial on this topic, but if you read the File I/O chapter of Bruce Eckel's Thinking in Java (which you can download at http://mindview.net/ ), you can have File I/O basics down in a couple of hours. (My thoughts) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher and WEB-INF
I do not think you can forward to a .exe file, not sure of what the spec says but the Javadoc says only JSP or HTML files. This link will probably get broken in your mail client, but if you reassemble it you can read the doc: http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/RequestDispatcher.html#forward(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse) Erik -Original Message- From: rf [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 3:51 AM To: [EMAIL PROTECTED] Subject: RequestDispatcher and WEB-INF I want to give out an exe after an authorization. So I put the exe in WEB-INF to avoid direct access, and tried to do: RequestDispatcher rd = req.getRequestDispatcher(/WEB-INF/my.exe); rd.forward (req, res); Tomcat 4.0.6 says /WEb-INF/my.exe cannot be found. I dont know how this is different from what Craig mentioned at http://marc.theaimsgroup.com/?l=tomcat-userm=99790295202902w=2 Thank you Rf __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is the best book about Servlets/Jsp?
There's a free one that I found helpful at http://pdf.coreservlets.com/ Be sure to read it in conjunction with the current Tomcat documentation, because although it's a very good book, there are a few (very few) references that are now out of date. If you read the Tomcat docs you will spot them right away (things like where in the filesystem to deploy your webapp, etc). Erik Jose Euclides da Silva Junior - DATAPREVRJ wrote: Regards, Euclides. Imagination is more important than knowledge. -Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat ant tasks (docs?)
Wendy Smoak wrote: Now I'm trying to use the tomcat ant tasks to automate things, and I'm running into problems. First, I can't reload this app with the ant task. It says: w:\java\bendevant reload Buildfile: build.xml reload: BUILD FAILED file:w:/java/bendev/build.xml:159: java.io.IOException: Server returned HTTP res ponse code: 401 for URL: http://localhost/manager/reload?path=%2Fbendev Total time: 1 second w:\java\bendev I can reload it manually using the manager app, and I get: OK - Reloaded application at context path /bendev I have not used the ant custom task (catalina-ant.jar) that does reloading, I have written my own with wget. But one of the issues is that the /manager webapp requires HTTP authentication to work. In my wget command I supply the --http-user and --http-pass arguments. You may have a session cookie in your browser that is letting you reload without specifying these, which may explain why it works in your browser but not in your ant script. Does your ant task provide the HTTP authentication credentials? According to the example build.xml comments, you need to set a manager.username and manager.password property for the ant script to access the /manager app with. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is the best book about Servlets/Jsp?
Shapira, Yoav wrote: To other people who answered, and to the original poster of this question: what do get from the books that you can't get online? Do you not find that the books, or at least parts thereof, become outdated very quickly? Yoav, I'm not sure if you're familiar with the book at http://pdf.coreservlets.com/ but although it is somewhat dated, it's very well-written for newbies. I'd almost go so far as to say hand-holding. I'm sure the Sun book is just as good, but that wasn't the first thing I found when I did a google search for best jsp servlet book. At that time I had every intent to purchase a book, but when I found the PDF-based Core Servlets book, I simply downloaded a chapter at a time, printed it out, and read it. The Core Servlets book gave me a pretty solid foundation in the ideas behind servlet/JSP programming (I was a CGI Perl/PHP programmer, new to Java, so as you can imagine things are considerably different), and the Tomcat docs + this mailing list have provided me with all of the additional information I've needed. I didn't even know what J2EE really was when I got started with all of this, but because I feel somewhat comfortable (though not necessarily competent) writing servlets/JSPs after my experience with this book and this list, I recommend it to others posting on the list asking what is a good book. If I read a book that I had a lot of problems with, I point those out too. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is the best book about Servlets/Jsp?
Mike Jackson wrote: However I'll agree, I don't look at the books often, usually by this point I go to the java docs. I'll second this, the javadocs are much quicker than going to a book now that I know where to look for stuff. The book was just a great way to get the basics down. And for clarification on some things I peruse the spec, though I haven't had time to actually read it straight through. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat ant tasks (docs?)
Wendy Smoak wrote: It's taken almost straight from the example: target name=reload description=Reload Web application depends= reload url=${manager.url} username=${manager.username} password=${manager.password} path=/${context}/ /target (With the appropriate properties set, of course.) And I get: w:\java\bendevant reload Buildfile: build.xml reload: BUILD FAILED file:w:/java/bendev/build.xml:159: java.io.IOException: Server returned HTTP res ponse code: 401 for URL: http://localhost/manager/reload?path=%2Fbendev Total time: 2 seconds w:\java\bendev It does work manually from the manager app: OK - Reloaded application at context path /bendev with this URL: http://localhost/manager/html/reload?path=/bendev Looks the same to me... Hmm... not to be contradictory but those two URLs are not the same, if you look closely. (One is manager/html/reload, the other is manager/reload.) But I do not know much about the /manager app, so this might not be the source of your problems. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is it possible to use setAttribute for request in jsp??
Ashish Kulkarni wrote: Hi Filip, I know, but i want to achieve some thing like reqeust.setAttribute(), i dont want to save the object in session, as then i will have to put some logic to get it out of session, or size of session will go on increasing, and will create problem in future Setting an attribute in the request with request.setAttribute() will only persist for the lifetime of the request. Which means that you cannot submit to a form (this causes a new HTTP request). In theory you could call RequestDispatcher.forward() on a new JSP page and that attribute /should/ persist, but that is not the same as submitting a form. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] free Database with Transaction (Sorry for the noise)
Turner, John wrote: Without going into a whole argument...technically MySQL is not free for commercial use. If you use MySQL in a commercial setting, internal or external, without purchasing a commercial license, you may do so only if the application that uses MySQL is also GPL (http://www.mysql.com/products/licensing.html). This is something that many companies (and developers) would prefer to avoid, for various reasons. PostgreSQL has no such requirement as it is distributed under the BSD license. Sorry, this is incorrect. You may use it in a commercial setting without a commercial license in a non-GPL'd application if you do not redistribute the MySQL software. In other words, if the customer of your application downloads and installs MySQL herself, then she is able to use MySQL to power the application regardless, without a commercial license and without requiring the application to be GPL'd. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] free Database with Transaction (Sorry for the noise)
Turner, John wrote: I guess MySQL AB should remove the phrase internal or external from the statement, then. ;) I agree, it is confusing, and doesn't even say what context internal or external refers to. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Basic Auth with Apache+Tomcat
Jake Robb wrote: Seems to me that if Tomcat had that information, it would be in the Session variable, not the Request variable. See if maybe it's available via Session.getAttribute(). The variables (sometimes called cgi variables since CGI is what they are historically used with) sent by the user are sent in the HTTP request, which is why they are held in the HttpServletRequest object (not the HttpSession). String user = request.getRemoteUser(); Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] question about killfile
Denise Mangano wrote: Hey all :) Sorry for the dumb question... But I keep seeing people talk about a killfile. Seeing as how this is the first list I've ever subscribed to, I had to ask - what exactly is a killfile? You guessed it -- a file of email addresses whose email you don't want to see. It actually stems from Usenet since you couldn't reject newsgroup postings (everyone on the server needs access to them) but the killfile would prevent certain posters' postings from appearing in your newsreader. Without pointing fingers, there are some poster(s) I'd like to block. I know I can block the address, or set up a rule in Outlook to automatically move messages from a specific address to the deleted items folder... But I was just curious if this killfile was something different, and more effective. Same diff. Note that I couldn't get Outlook filters to work very effectively -- it seemed that for some reason I'd get lots of mail slipping right through them. I think partly because Outlook uses some complex wizard to help decide for you how to filter the email, rather than just letting you say move all messages with content in email header to folder. That's the main reason I moved to Mozilla for mail. (Very satisfied with it, btw.) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: An easy one... Default Config in conf/web.xml
Andoni wrote: Thanks for that. I think I'll look up your other recommendations first. I don't know ant at all so I'll start with the other one. Ant is worth learning -- you can figure it out in a couple of hours. It will make all of your webapp deployment a lot easier. There is a decent ten-page tutorial at http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/ant/ant.pdf (Your mail client may break the URL so be sure to repair any spaces in it. Also, that's a PDF.) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RTFM and Ettiquette was: MY ATTITUDE
Paul Brinkley wrote: The solution that causes the least amount of distress to all parties (that I can think of) is to teach netiquette to Internet newcomers in some hard-to-avoid location. [...] Unfortunately, this is a culture change, and hence it will take a while, possibly as much as a generation (25 years) or more. Those of you with kids: start now... And those of you who refuse to do some legwork before posting to the list, please don't have kids. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting up logging - Log4j
Robert Priest wrote: So the general consensus is Log4j over jdk1.4 logging including commons-logging so in the future when we upgrade and/or switch loggers it will be easier? Hmmm... I heard one person speak out against commons-logging because it is a class loader hack, which appears to introduce its own level of problems to the table. Just for the record. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about singletons (ot)
Hey Mike, Thanks for explaining this. Your examples make it very clear. When I am done with Effective Java I plan to pick up one of the threads books (both seem to be equally well-recommended). I understand the basic idea of threads, but it's tips like this (using synchronized blocks instead of synchronizing the entire method, for performance) that I don't know much about. Erik Mike Jackson wrote: Hmm, I wish I'd been paying attention to the list, but basically yes. You get finer control by using synchronized code blocks. Really the major reason is that you in most cases don't really need to synchronize the entire method, only small portions of the code. For example: protected static Object lock = new Object(); protected static int nextId = 1; public int getNextId() { int id = -1; synchronized( lock ) { id = nextId; nextId++; } return id; } public void setNextId( int i ) { synchronized( lock ) { nextId = i; } } As you can see we've got protection for the variable we care about, namely nextId. And we've got it setup such that you can have threads accessing nextId both in the getNext and setNext methods. Now you're probably saying that you could use the synchronized statement on the methods here. The answer to that is nope, when you synchronize the method you're synchronizing on this, since the goal is to protect a static variable you're not going to want to do that. Now even if the nextId wasn't static, you have to consider that you might be doing other work in the methods. Work that doesn't need to be synchronized. For example we might have something like this: protected int id = 1; public synchronized void spin( int i ) /* start crit section */ int i, max = id; id++; /* end crit section */ for ( int i = 0; i max; i++ ) { ; } } Ok, so this code is safe, but is it efficent? We're blocking threads from entering which will protect the id variable, but we'll be taking time outside the crit section which will also be protected. Clearly we don't really want to do this. A better way to do this is: protected Object lock = new Object(); protected int id = 1; public synchronized void spin( int i ) int i, max; /* start crit section */ synchronized( lock ) { max = id; id++; } /* end crit section */ for ( int i = 0; i max; i++ ) { ; } } We're still protecting the crit section, but we aren't impeding other threads from entering and even completing their pass through the method prior to our finish. However sucky examples and all making code thread safe is a lot of work. There's some recipes out there for generating thread safe code, but quite frankly I don't remember them any more. But there's some really good books that we mentioned by other people, the addison westley book is good, and the o'reilly threads book is good. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 12:26 PM To: Tomcat Users List Subject: Re: about singletons (ot) So you mean that the original author (mike jackson) was saying that he used synchronized code blocks to apply a finer level of detail in specifying what is synchronized and what isn't, as opposed to just declaring an entire method synchronized? I understand that synchronization implies a performance penalty, but I wasn't sure what the advantage to using synchronized blocks over synchronized methods was. Erik Tobias Dittrich wrote: The reason why you don't want to use synchronized methods is that a synchronized block can only be executed by one thread at a time. Every other thread wanting to access this method will be blocked during this time (well, basically). So you want to try to keep the synchonized blocks as small as possible. Having said that I wonder weather performance is an issue in the singleton vs only-static discussion. Is there a significant difference in execution speed? After all one has to make one additional method call every time when accessing a singleton method (the getInstance() which is synchronized, too). And since we're off topic anyway: is a call to a static method faster than a normal one to an object (well, I mean the overhead from the method call, not the execution speed of the method body ... )? Cheers Tobi From: Erik Price [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 1:46 PM Subject: Re: about singletons (ot) Mike Jackson wrote: The difference is that if you use a singleton there's one instance. If everything is static then you only have one copy. Usually when you use a singleton it's to control access to some resource, the intent is that you use the singleton and some synchronized calls (note I don't mean synchronized methods, but synchronized code blocks) to control threads using that resource. Why could you not use
Re: java/jsp dynamic data
Jeff Ousley wrote: I though maybe an applet would suit my needs, but it needs to access data on remote hosts. Doesn't the applet security prevent this? Have the applet consult the originating server for data, and have the originating server do the work of querying the remote server. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MY ATTITUDE
Hi Steve, RTFM means Read the friggin' manual. It is used in almost any place where a person is asking a question when they could have read a document instead. The idea is that nobody has extra time sitting around to waste re-explaining things that have been explained perfectly well elsewhere. In your case, I think what you ought to read is the manual of mailing list etiquette. At first I thought you were a joker or someone who found it amusing to post the same questions again and again with strange exclamation points () and colloquialisms such as Capiche. I thought you were being rude, but I think now I realize that you just don't know any better. You are getting fewer answers every day because more and more people have set up their email clients to filter out your posts. It has become tiresome to read the same questions again and again, when others have pointed you to perfectly fine tutorials explaining how to go about it. If these tutorials are not a good enough explanation, then perhaps you ought to step down a notch to something more basic. Configuring Tomcat and writing JSP/servlet webapps is not easy, and requires that you understand the fundamentals of the Java language. There are dozens of free books with thousands of pages dedicated to this topic, a good one is Thinking in Java at http://www.mindview.net/ . A specialized mailing list like this one is dedicated to answering questions and discussing issues surrounding Tomcat, not explaining the syntax of a switch statement. Don't take that as an insult, I'm just explaining how it is. Sun offers an excellent forum for programmers who are new to Java at http://forum.java.sun.com/forum.jsp?forum=54 . But the problem at hand isn't even really whether or not this is the appropriate mailing list for you. You are not getting much help because you simply do not know the protocol for asking questions on a mailing list. It is not appropriate to discuss anything but Tomcat, or Tomcat-related issues on this list. Not switch statements. Not personal issues regarding your social development. People will forgive you if you make a mistake in this regard once in a while. But this has become a daily affair. I am going to give you one last hyperlink, and I really hope that you click it and read the web page it takes you to. Others have already given you this, and I can only assume that you haven't found time to read it yet. But please read this document. It will take you all of fifteen minutes. If you don't, or if you read it but choose not to listen, then no one on any mailing list is going to help you, as more and more people tune you out with email filters. The document is called How to Ask Questions the Smart Way, and is available at http://catb.org/~esr/faqs/smart-questions.html . It is the friggin' manual for all mailing lists. RTFM. Erik Steve Burrus wrote: Matthew, please forgive my *dumb naivety*, but what does RTFM mean,i.e., what does it stand for exactly anyway? I hope that this doesn't sound like some kind of a rant [again], but it seems like for a long time now people in this newsgroup have ragging on me! Capiche?! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JAASRealm/LoginManager questions
Craig R. McClanahan wrote: It seems a little convoluted, but, what it buys me is, any Servlet container which supports form-based authentication, and which supports JAAS for realms (or equivalent), can harness this toolkit. I assume (but have not verified) that this buys me into the major J2EE containers -- Weblogic, SunONE, Websphere, etc, in addition to my favorite (Tomcat). Does this sound like it would work? Ah, if only it would ... it would require a change to the servlet spec to allow filters to perform container managed security authentications. From a container writer's point of view, I get a little uneasy thinking about delegating this responsibility to an application -- but I can see some use cases for it. Pardon me for butting in on this thread, which isn't mine, but I have a question... My webapp uses its own authentication system, where every resource is protected by a filter that consults the session to see if the user is authentic or not, and if not, then redirects to the login page. Is this the scenario that, above, you describe as making you feel a little uneasy? I'm just curious if there's any conventional wisdom about webapp authentication of which I am out of the loop and haven't heard yet. If this is the case, what are some use cases that would need something like that? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Valve Access to Principal
Craig R. McClanahan wrote: Tomcat 5 has integrated support for JSR 115, but that's for authorization, not authentication. Oh no, there's a difference? Is there an explanatory document somewhere that I missed? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class loader in JSP file
Ing. Gustavo Edelstein wrote: Hi list! I've a jsp page that use a xx class that I wrote. I put the file class xx.class in WEB-INF/classes but Tomcat cannot find it from my jsp page. Any idea? Thanks, Did you import the class with the %@ import % JSP directive? Don't forget to use a fully-qualified classname in the import directive. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SendMailServlet - problem, debugging tips
chris schild wrote: Would anyone be able to provide some debugging tips for Tomcat servlets? Logging. Also, what would cause a servlet to be unavailable? If you didn't map the servlet to a URL-pattern in your web.xml. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about options
Hi, It can also be done (unreliably) with JavaScript/frames. I would never use this approach, but the idea is similar to what some domain name registrars use for what is called stealth forwarding (giving the appearance of mapping one URL to another without a true IP mapping). The trick is simply to create a frameset with one giant frame occupying the entire window. You simply have all of the action happening in the frame (where the URL is not displayed), and use JavaScript to change the value of the browser's actual URL. This doesn't truly hide the querystring since any competent user can view the source code or disable the frames, but it might achieve the effect you want. Erik Shapira, Yoav wrote: Howdy, If you want to do this at all, you will definitely need Apache. I'm not even sure you could do it with Apache with 100% success. You will need to do a lot of rewriting and some other rules, maybe converting GET requests to POSTs with the query string parsed into form parameters or something like that. This type of request is against the spirit of the HTTP protocol in some ways ;) What is your design goal? If you share some more details perhaps people can help you arrive at the same goal via a better way... Yoav Shapira Millennium ChemInformatics -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 9:11 AM To: Tomcat User List (E-mail) Subject: Question about options What needs to be configured to hide the query string in the address bar? Will this require Apache to do? Luc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SendMailServlet - problem, debugging tips
tomcat guy wrote: The logs do not seem to tell me a lot. Any suggestions? Err, I didn't mean checking the Tomcat logs (though that helps). I meant that one way to debug servlets is to use a logging framework for your application like Log4J. I wish I could be of greater help with respect to the specific problem you're having. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet URL
Felipe Schnack wrote: I'm writing a servlet that requires to be a Singleton (much like Struts' servlet), and I have some other objects that need to know the URL of this Servlet to make some redirects to it... so I need this servlet to have a method that return its URL, as in web.xml Presumably this doesn't change, right? You could either store it as a constant (public static final String) of the servlet or as a web.xml context-parameter. I can get this from HttpServletRequest?? You can get various parts of the URI from the HttpServletRequest in that particular servlet, since presumably the request contains the URL that was used to fetch the servlet. But doesn't sound like what you are looking for (a way to determine the URL from within other classes, not the servlet). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet URL
Felipe Schnack wrote: Sorry, context-parameter? But then I wouldn't have (again) my servlet's URL written in two different places? This kind of thing worries me, because somebody can change in one place but not on another. You're right, this kind of data redundancy can be dangerous, and there are probably better ways to do it. I was just giving you two suggestions on where you could store the URL so that it is accessible to other objects in your webapp. I think I can understand the HttpServletRequest way of doing it... but then I could only determine after my servlet is first called, right? Right, this won't work if you're trying to get the URL from an unrelated class, like a bean or something, unless you have some way of passing the request in. Anyway, how I would do that? Getting all bytes from the string from the beginning 'till the end or '?' character? public void doProcessing(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String url = request.getRequestURL(); } Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP's in other directories
Nicholas J Campbell wrote: Hi, I have a question, I want to be able to access JSP pages that are outside of the web-inf directory setup by tomcat I do not know how to do it, obviously. I have Apache 2 installed and use that at my main server and then am running tomcat for the purposes of Servlets and JSPs and I want to know what I have to do to make myself be able to access a jsp page that is in a directory like c:\site You should generally be able to refer to resources in your site by using a path relative to the context. For instance, I have the following site structure: /MyApp index.jsp main.jsp others.jsp /WEB-INF /classes /com /ptc /myapp SomeClass.class OtherClass.class /server SomeServlet.class OtherServlet.class /lib somejar.jar To access one of my JSPs from another JSP, I just use a relative path in the HTML part of the JSP. To forward to one of my JSPs from a servlet, I use the following line of code: String TARGET_JSP = /main.jsp; javax.servlet.ServletContext sc = this.getServletContext(); javax.servlet.RequestDispatcher rd = sc.getRequestDispatcher(TARGET_JSP); rd.forward(); That's one way to do it, even though the servlet is in /MyApp/WEB-INF/classes and the JSP is in /MyApp. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WAR format question
Jacob Kjome wrote: In order to obtain access to a file under WEB-INF in a completely portable way, use something like... getServletContext().getResourceAsStream(/WEB-INF/myproperties.xml); What about if we have a tag descriptor somewhere below WEB-INF, is it safe to refer to the path directly from the uri attribute of the %@ taglib % directive? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]