comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * JSP JavaBeans problem in scope="session" attribute - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 * Static class - one per JVM or one per app? - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca34807378a1843d * Calling the native Linux mutt module from Java... - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52d060d3a36936c5 * how to post UTF-8 values to a servlet - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8720339cb557e8ea * Free web - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20e20c9b4221662e * subscribing to JMS queue on a different server ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c92139ead135c5f0 * equals vs == - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93c9522d56ea8805 * Regexp to extract filename from g++ output - 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d495dd5db4858206 * Setting DOCTYPE to a DOM- document - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f0a2e7258baad09 * Hot ot start programming in Personal Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1807370f489fc74b * Unable to load RMI with external classes - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fc5d06e3882be7c * How to change 3 to "003" - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f04fef73a25ccc0 ============================================================================== TOPIC: JSP JavaBeans problem in scope="session" attribute http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 12:15 pm From: [EMAIL PROTECTED] > You still need to have the bean tag in your other pages though. The > "session" means that a new bean won't be created on another page, > rather the bean you created on the first page will be maintained. what do you mean by bean tag? <jsp:useBean id="user"> ?? == 2 of 2 == Date: Mon, Dec 20 2004 3:46 pm From: "John C. Bollinger" [EMAIL PROTECTED] wrote: >>You still need to have the bean tag in your other pages though. The >>"session" means that a new bean won't be created on another page, >>rather the bean you created on the first page will be maintained. > > > What do you mean by need the bean tag? > > Do I need to declare the following in page2.jsp also? > <jsp:useBean id="user" class="com.proj1.model.User" scope="session"/> Yes, exactly so. The main purpose of a <jsp:useBean> action is to _declare_ a bean to the rest of the page implementation, and every page must declare all the beans it uses. The action will create a bean of the specified type, bound to the specified name, and assigned to the appropriate scope if none yet exists, but that is best considered a side effect rather than the goal of the action. John Bollinger [EMAIL PROTECTED] ============================================================================== TOPIC: Static class - one per JVM or one per app? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca34807378a1843d ============================================================================== == 1 of 4 == Date: Mon, Dec 20 2004 12:15 pm From: [EMAIL PROTECTED] I have a class called MyClass that contains a static variable (myVar). I have two J2EE apps running on WebSphere under the same JVM, MyFirstApp and MySecondApp. From MyFirstApp i set the value of myVar by doing MyClass.setMyVar(3). ....what will be the value of MyClass.getMyVar() when run from MySecondApp? ie - will the static var have scope across the whole JVM or just the web app? Thanks David Bevan http://www.davidbevan.co.uk == 2 of 4 == Date: Mon, Dec 20 2004 12:18 pm From: "cnpeyton" If you have 2 physical ear files, each with a web module, then you have different class loaders for the two applications. You will have 2 copies of MyClass, one for each class loader. If you want to get around this, you would have to move the access of MyClass to a class loader higher up the chain that would be accessible to both applications. A different route would be to have 2 web modeuls in the same EAR. If you package MyClass into a utility jar and put it in the EAR and then marked it as available to the 2 different web modules, then i think you would have only 1 copy of MyClass since there would only be one application class loader. You do have a class loader for each web module, but since the class wouldn't be accessible to this class loader, loading would be delegated to the parent which would be the application class loader. There is a utiltiy from IBM called class loader viewer that is a plugin for WebSphere that will allow you to browse class loaders for applications and modules. I'll dig up the link and post it here. Chris == 3 of 4 == Date: Mon, Dec 20 2004 12:22 pm From: "cnpeyton" Here is the link to the WebSphere class loader viewer. I have found this to be a very handy utility in diagnosing class loading problems. You can browse class loaders for an applications, see what jars and classes they have access to, search for classes and see which class loaders can resolve them, etc... http://www-128.ibm.com/developerworks/websphere/library/techarticles/0312_cocasse/0312_cocasse.html Chris == 4 of 4 == Date: Mon, Dec 20 2004 12:26 pm From: [EMAIL PROTECTED] Thanks, what you say sounds promising since I actually want separate values of MyVar for each app. David Bevan http://www.davidbevan.co.uk ============================================================================== TOPIC: Calling the native Linux mutt module from Java... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52d060d3a36936c5 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 9:22 pm From: Gordon Beaton On Mon, 20 Dec 2004 19:29:27 GMT, K2 wrote: > Thanks Gordon, that was helpful, however it brought up another > issue. I'm providing the demo code here that includes the comments > on setting it up and the problem that I've run into... A couple of things: - read from both output and error streams *while* the process is runnning, not afterwards. There is limited buffer space available for the process write to until you start reading, so not reading while the process runs could cause it to block if it has more output than will fit. - when you tokenize the command line as you've done, put each separate argument in its own String. As written, the first argument to mutt is "-s \"Unit Tests results\"", which I suspect should be two separate arguments, the option and its value. Note that there is no need to add extra quotation marks around arguments with spaces; the command line won't be processed or tokenized any further. Write it like this instead: String[] testArgs = { "/usr/bin/mutt", "-s", "Unit Tests results", "-i", "/tmp/results.txt", "-c", args[0] }; - close all three Process streams after the child process has finished. /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e ============================================================================== TOPIC: how to post UTF-8 values to a servlet http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8720339cb557e8ea ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 8:41 pm From: Collin VanDyck > the HTML file containing the form itself is definitely encoded in UTF-8, and > the form tag looks like this: > > <form action="http://localhost:8080/foo/servlet" method="post" id="form1" > charset="UTF-8" name="form1"> > <INPUT type="text" name="foo"> > </form> > > In the servlet I'm just calling request.getParameter("foo"); > > If I type in an English pound sign £ (this is the English currency symbol, > not #), I get £ (which is A circumflex followed by the pound sign). > > I've been playing with various variations for 1/2 a day now and it's > starting to get me rather frustrated. Can anyone point me in the right > direction. > How are you testing for the value of getParameter("foo") ? If you are outputting to the console and you are using Windows, you will very likely get gibberish, as the Windows console does not output UNICODE properly. If this is true (console), then try outputting to a file instead and open the text file with a UNICODE capable text editor. Sorry if you've tried this already -- I beat my head into the wall for a week before asking this same question on alt.text.xml and getting this answer rather quickly. Collin ============================================================================== TOPIC: Free web http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20e20c9b4221662e ============================================================================== == 1 of 4 == Date: Mon, Dec 20 2004 8:58 pm From: "Ayrton" Do you know where can I find a host to put my web site in Java ? == 2 of 4 == Date: Mon, Dec 20 2004 9:08 pm From: Collin VanDyck Ayrton wrote: > Do you know where can I find a host to put my web site in Java ? > > Assuming you want to use servlets you could start here: http://www.kattare.com/index.kvws I am using them currently for a servlet driven site and they have very good support. Also, search for "JSP Hosting" or "Servlet Hosting" on Google. == 3 of 4 == Date: Mon, Dec 20 2004 3:40 pm From: The Abrasive Sponge Collin VanDyck wrote: > Ayrton wrote: > >> Do you know where can I find a host to put my web site in Java ? >> >> > Assuming you want to use servlets you could start here: > > http://www.kattare.com/index.kvws > > I am using them currently for a servlet driven site and they have very > good support. > > Also, search for "JSP Hosting" or "Servlet Hosting" on Google. > But, note, that it is not free. == 4 of 4 == Date: Mon, Dec 20 2004 10:52 pm From: Collin VanDyck The Abrasive Sponge wrote: > Collin VanDyck wrote: > >> Ayrton wrote: >> >>> Do you know where can I find a host to put my web site in Java ? >>> >>> >> Assuming you want to use servlets you could start here: >> >> http://www.kattare.com/index.kvws >> >> I am using them currently for a servlet driven site and they have very >> good support. >> >> Also, search for "JSP Hosting" or "Servlet Hosting" on Google. >> > > But, note, that it is not free. Whoops :) Yes, it is not free. Sorry about that! ============================================================================== TOPIC: subscribing to JMS queue on a different server ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c92139ead135c5f0 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 10:12 pm From: gabriel Greetings I got the following thing : A tomcat (A) with a servlet which needs to subscribe to a queue held in JBoss server (B) situated on another point of the network (say on the same lan). I can do it if tomcat would hold both servlet and JMS but I do not know how if it's on separate servers or machines... My question is : how can I do this ? many thx if someone has some tips :) ============================================================================== TOPIC: equals vs == http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93c9522d56ea8805 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 1:10 pm From: Scott Ellsworth In article <[EMAIL PROTECTED]>, "Tony Morris" <[EMAIL PROTECTED]> wrote: > > (e.g., "yes, but there's no pointer pointer arithmetic or > > dereferencing" etc). > > You don't get the job. The one time I was asked that, I asked whether the interviewer meant from a programmer's perspective, from a JVM perspective, or from a JIT designer's perspective. (Not as off the wall a distinction as it sounds - the company did a lot of JNI, and providing a better jitc was not completely out of scope.) Apparently, there were plus points for asking whether he considered a C++ reference as a pointer or not. I got that job. Scott ============================================================================== TOPIC: Regexp to extract filename from g++ output http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d495dd5db4858206 ============================================================================== == 1 of 6 == Date: Mon, Dec 20 2004 1:43 pm From: [EMAIL PROTECTED] (Mike) hi all, i am trying to extract the filename from a g++ compiler message but cannot find a regexp that handles the optional column part correctly. the message is in the format: c:\tmp\test.cpp:1: type: messagetext or c:\tmp\test.cpp:1:20: type: messagetext OR /tmp/test.cpp:1: type: messagetext or /tmp/test.cpp:1:20: type: messagetext thanks a lot! mike == 2 of 6 == Date: Mon, Dec 20 2004 9:52 pm From: Collin VanDyck > c:\tmp\test.cpp:1: type: messagetext > or > c:\tmp\test.cpp:1:20: type: messagetext > > OR > > /tmp/test.cpp:1: type: messagetext > or > /tmp/test.cpp:1:20: type: messagetext > > thanks a lot! > > mike Maybe try Pattern p = Pattern.compile("^([^:]+):"); That will match all characters up to the first colon. I didn't infer from your post that you needed to catch the column numbers, only the file name. When you create a matcher on this Pattern, you'd use the first group: matcher.group(1) to get the part that matched the filename. Does this help at all? Collin == 3 of 6 == Date: Mon, Dec 20 2004 11:30 pm From: "Virgil Green" Collin VanDyck wrote: >> c:\tmp\test.cpp:1: type: messagetext >> or >> c:\tmp\test.cpp:1:20: type: messagetext >> >> OR >> >> /tmp/test.cpp:1: type: messagetext >> or >> /tmp/test.cpp:1:20: type: messagetext >> >> thanks a lot! >> >> mike > > Maybe try > > Pattern p = Pattern.compile("^([^:]+):"); > > That will match all characters up to the first colon. I didn't infer > from your post that you needed to catch the column numbers, only the > file name. > > When you create a matcher on this Pattern, you'd use the first group: > > matcher.group(1) > > to get the part that matched the filename. > > Does this help at all? > > Collin Try this... which accommodates the Windows-style path and Unix-style paths. Only partially tested. (([a-zA-Z]):|)(\\|/)[^:]+ == 4 of 6 == Date: Mon, Dec 20 2004 11:32 pm From: Tilman Bohn In message <[EMAIL PROTECTED]>, Collin VanDyck wrote on Mon, 20 Dec 2004 21:52:30 GMT: >> c:\tmp\test.cpp:1: type: messagetext >> or >> c:\tmp\test.cpp:1:20: type: messagetext [...] > Pattern p = Pattern.compile("^([^:]+):"); > > That will match all characters up to the first colon. Which, in the first two examples, will be `c'. So the next attempt would include finding strings of only digits between colons. However, this one is tricky because c:1 is actually a valid pathname in DOS (without any leading backslash this refers to the file or directory named `1' in the current directory of drive c:). To be honest though, I'm not sure if this (i.e., a cwd per drive) is just a quirk of command.com and cmd.exe or a part of DOS/Windows's internal book-keeping. (And in any case I'm not sure whether the output would ever include such a pathname!) Anyway, the point is that it might be impossible to tell algorithmically whether the first colon is part of a drive/path combination or the separator between the filename and line, because c:1:10 might be column 10 of line 1 of file c in the cwd (unix style) _or_ line 10 of file 1 in the cwd of drive c (DOS style). And to top it all off, on MacOS classic, where the colon is the regular dir separator, the same output could refer to line 10 of file 1 in the folder named `c'... So I suspect your best bet for robustness would be to check for the value of File.separator and use a different pattern accordingly... Anything else I think might break sooner or later. -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright == 5 of 6 == Date: Mon, Dec 20 2004 11:32 pm From: "Virgil Green" Virgil Green wrote: > Collin VanDyck wrote: >>> c:\tmp\test.cpp:1: type: messagetext >>> or >>> c:\tmp\test.cpp:1:20: type: messagetext >>> >>> OR >>> >>> /tmp/test.cpp:1: type: messagetext >>> or >>> /tmp/test.cpp:1:20: type: messagetext >>> >>> thanks a lot! >>> >>> mike >> >> Maybe try >> >> Pattern p = Pattern.compile("^([^:]+):"); >> >> That will match all characters up to the first colon. I didn't infer >> from your post that you needed to catch the column numbers, only the >> file name. >> >> When you create a matcher on this Pattern, you'd use the first group: >> >> matcher.group(1) >> >> to get the part that matched the filename. >> >> Does this help at all? >> >> Collin > > Try this... which accommodates the Windows-style path and Unix-style > paths. Only partially tested. > (([a-zA-Z]):|)(\\|/)[^:]+ Forgot to add additional escaping for use in Java source: (([a-zA-Z]):|)(\\\\|/)[^:]+ == 6 of 6 == Date: Mon, Dec 20 2004 3:42 pm From: Tilman Bohn In message <[EMAIL PROTECTED]>, Virgil Green wrote on Mon, 20 Dec 2004 23:30:28 GMT: [...] > Try this... which accommodates the Windows-style path and Unix-style paths. > Only partially tested. > (([a-zA-Z]):|)(\\|/)[^:]+ 1. (foo|) is normally written (foo)?. (Purely cosmetics.) 2. Is the compiler output guaranteed to only ever contain absolute pathnames? 3. Colons are valid characters in Unix file and directory names. -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright ============================================================================== TOPIC: Setting DOCTYPE to a DOM- document http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f0a2e7258baad09 ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 11:10 pm From: Michael Preminger Thanks alot! Sorry to bother you with it, but I found the following possibility : (Is this what you were pointing to?) DocumentType newDocType=builder.getDOMImplementation().createDocumentType( "html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" ); newDoc = builder.getDOMImplementation().createDocument( "http://www.w3.org/1999/xhtml", "html", newDocType); Which at the first attempt in fact seemed to work, but when I reordered the code, putting things into methods a.s.o I seem to have lost it. The above procedure now produces the following: <?xml version="1.0" encoding="UTF-8"?> <html><head> No Doctype. I cant for my lifetime figure out what Im doing wrong!! Thanks John C. Bollinger wrote: > Michael Preminger wrote: > >> I am trying to create an XHTML-document using the org.w3c.dom and >> javax.xml.transform package, but cannot find >> any elegant way of putting a <DOCTYPE declaration into the output >> document. >> >> I create a Document object with the newDocument() method of a >> javax.xml.parsers.DocumentBuilder object, and writing it out using an >> identity transform, (as in sun's tutorial >> http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html) > > > You cannot set a DocumentType on an existing Document, but you should be > able to create a Document that has the desired type in the first place. > Get a DOMImplementation object from your DocumentBuilder -- it has the > methods you need. > >> The turorial has a recommendation for processing DOCTYPE, using the >> following code: >> ... >> if (document.getDoctype() != null){ >> String systemValue = (new >> File(document.getDoctype().getSystemId())).getName(); >> transformer.setOutputProperty( >> OutputKeys.DOCTYPE_SYSTEM, systemValue >> ); >> } > > > Not immediately relevant. That's for _processing_ the DocumentType for > a Document when it has one; it is not useful in assigning a DocumentType > to a Document instance that doesn't already have one. You may find it > needful after you get a Document containing DocumentType node, but you > may find that you don't need it at all. > >> But this does not seem to have the effect I expect, and is probably >> not intended for my expressed need. >> >> >> Is there a standard way of setting a >> <DOCTYPE ...> declaration to a DOM - document created in this way, or >> do I have to create my XHTML some other way? > > > See above. > > > John Bollinger > [EMAIL PROTECTED] == 2 of 2 == Date: Mon, Dec 20 2004 6:05 pm From: "John C. Bollinger" Michael Preminger wrote: Please do not top-post. > Thanks alot! Sorry to bother you with it, but > > I found the following possibility : (Is this what you were pointing to?) > > DocumentType > newDocType=builder.getDOMImplementation().createDocumentType( > "html", > "-//W3C//DTD XHTML 1.1//EN", > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" > ); > > newDoc = builder.getDOMImplementation().createDocument( > "http://www.w3.org/1999/xhtml", > "html", > newDocType); Yes, that is what I had in mind. > Which at the first attempt in fact seemed to work, but when I reordered > the code, putting things into methods a.s.o I seem to have lost it. "Seems to work" as judged how? You were able to produce the desired output from a Document obtained in that manner? Or did you check it some other way? If the code worked before your refactoring but not after, then it follows that the refactoring was not performed correctly. > The above procedure now produces the following: > <?xml version="1.0" encoding="UTF-8"?> > <html><head> No it doesn't. The above procedure produces a reference to a Document object. The relationship between that object and the text you have shown is at best unclear. > I cant for my lifetime figure out what Im doing wrong!! I have little chance of figuring out what you're doing wrong if I can't figure out what you're doing. If you want further assistance then you will considerably aid your cause by preparing and posting a small, self-contained, compilable example that demonstrates the problem. John Bollinger [EMAIL PROTECTED] ============================================================================== TOPIC: Hot ot start programming in Personal Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1807370f489fc74b ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 11:19 pm From: mchm How to start which environment to choose are there any free environments?? What plugins should i choose ?? I'm trying to develop for SE P910i and HP PocketPC ============================================================================== TOPIC: Unable to load RMI with external classes http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fc5d06e3882be7c ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 10:26 pm From: "Ian" Hello! I have written quite a large application that uses RMI. I can run rmic and generate the skeletons which I copied to http://www.dur.ac.uk/i.j.hammond/project/codebase/. My application uses an external jar called ldapjdk.jar which is located in the same directory as all my class files. When I run java - Djava.rmi.server.codebase=http://www.dur.ac.uk/i.j.hammond/project/codebase RCSImpl I get the error java.lang.NoClassDefFoundError: netscape/ldap/LDAPException So I then set my classpath to read: java -classpath .:/home/hudson/ug/d25sg2/ldapjdk.jar - Djava.rmi.server.codebase=http://www.dur.ac.uk/i.j.hammond/project/codebase RCSImpl and I get the same error even though ldapjdk.jar does exist. I have also tried placing the jar in the codebase with no effect. If I remove the binding to the RMI in the RCSImpl class then all works fine and the jar is found. Does anyone have any advice? Thanks, Ian ============================================================================== TOPIC: How to change 3 to "003" http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f04fef73a25ccc0 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 3:39 pm From: The Abrasive Sponge Tony Morris wrote: > "Walter Mitty" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Tony Morris wrote: >> >>>"fishfry" <[EMAIL PROTECTED]> wrote in message >>>news:[EMAIL PROTECTED] >>> >>> >>>>How do I convert an int to a 3 (or n) -digit string? I found a couple of >>>>third-party implementations of sprintf(), but I was wondering what's the >>>>officially correct way to do this. >>> >>> >>>public class X >>>{ >>> public static void main(String[] args) >>> { >>> int x = 3; >>> System.out.printf("00%d", x); >>> } >>>} >>> >> >>Is this a joke reply? This solution is no different to saying the answer >>to the question is >> >>String s="003"; > > > It meets the stated requirement. > The response was no more of a joke than the request for assistance. > I cannot force someone to state their real requirement. > The stated solution differs somewhat to your provided analogy, depending on > context, which clearly is needed to provide a more complete answer. > Speculation is a best case scenario as it stands. > Damn, that was nice prose for a java newsgroup. ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
