comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Turn off boundary checks? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1fc5b4ab5a504cf9 * Removing whitespace or empty lines from JSP-generated HTML (Tomcat) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ab81ec775d98b282 * problem with java versions and jar - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2a7a12b44a2ec7c7 * comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2004-10-08) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90b563b4ff6f6003 * setObject / getSpecificObject - when to type check? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee5079d0a646ebb * Contructor bad practices----WAS: Re: Can someone use invokeLater()... - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 * Example of misusage of exceptions. - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/994f4051b1f6692c * Another jar problem ... - 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/689cb4b9d924d27f * integration java and vb.net? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7a6d56a9aec179f * flush attribute in JSP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c3cec6d3c4756ac * JSP Struts <logic:equal> tag questions - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/135efce4ed8c9cd * tomcat 4.1.30 and not recognizing new compiled code - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d037203a155ce61f * Does this finally get executed ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e0d9fa26e656cf72 * Struts iterate indexed nested objects - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4308a477a108f808 * applet's call comportement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c * A question to parse HTML files - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5792f3bd809986a * stack implementation - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c909f1ce5b4696a ========================================================================== TOPIC: Turn off boundary checks? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1fc5b4ab5a504cf9 ========================================================================== == 1 of 2 == Date: Mon, Nov 1 2004 1:20 am From: [EMAIL PROTECTED] (Jesper Nordenberg) Markus Dehmann <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > I know that automatic boundary checks for array accesses is a good thing, > prevents crashes at runtime and makes Java superior to, say, C. > > But what if I use arrays really heavily and I am sure that there are no > undefined array elements queried -- shouldn't there be an option to turn > the boundary checks off? It would probably improve the performance of my > program a lot. The same for automatic initialization. > > I mean I know that Java is a safe language and rather checks everything > twice to prevent undefined behavior or crashes. It's good to have this > behavior as a default. But, after extensive testing, I can be sure that > there are no invalid accesses, I would like to turn the automatic checks > and initializations off! Just to see if it runs faster. > > Is there a JVM that supports that? Could I, in theory, hack an existing > virtual machine to do that and re-distribute it? You can compile your code using GCJ which allows you to turn off array bounds checking. /Jesper Nordenberg == 2 of 2 == Date: Mon, Nov 1 2004 2:30 am From: Michael Borgwardt <[EMAIL PROTECTED]> Chris Smith wrote: > difference they make in time efficiency of your code. If you're > justifiably concerned by these sorts of differences, then you probably > want to be hand-coding performance-critical code sections in assembly > language anyway, and Java is not the right language to mix with > assembly. Huh? You can code naive Java methods in assembly just fine AFAIK. ========================================================================== TOPIC: Removing whitespace or empty lines from JSP-generated HTML (Tomcat) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ab81ec775d98b282 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 1:21 am From: [EMAIL PROTECTED] (Dirk Gómez) (Tomcat 4.1.31 on Solaris 7) I want to remove empty liens and whitespaces from my JSP-generated HTML: per every JSP command there is whitespace, per every JSP command line there is an empty line. Is there a parameter in Tomcat to turn off this behaviour or do I have to resort to post-processing my files? -- Dirk ========================================================================== TOPIC: problem with java versions and jar http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2a7a12b44a2ec7c7 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 1:58 am From: Jürgen <[EMAIL PROTECTED]> Hi, I can start my java programm with the syntax: java com.Main or javaw com.Main but If I pack my programm in a jar file and start it with: java -jar myprogramm.jar -parameter1 -parameter2 I get an unsupportedclassversionerror (major minor version 48). If I start my programm with javaw -jar myprogramm.jar -parameter1 -parameter2 I get the message "could not find main class. programm will exit." and if I start my programm with myprogramm.jar -parameter1 -parameter2 it runs but I don't get system.out.println messages on my console. If I run my programm in eclipse all is fine. Can someone tell my what is going wrong here. Thanks very much. Greetings jürgen ========================================================================== TOPIC: comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2004-10-08) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90b563b4ff6f6003 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 2:25 am From: [EMAIL PROTECTED] (David Alex Lamb) Last-Modified: Fri Oct 8 11:38:42 2004 by David Alex Lamb Archive-name: computer-lang/java/help/minifaq Posting-Frequency: every 4 days Before posting read Jon Skeet's "How to get answers on the comp.lang.java.* newsgroups" at http://www.pobox.com/~skeet/java/newsgroups.html Java FAQs and advice: - Java FAQ (Andrew Thompson) http://www.physci.org/codes/javafaq.jsp including his list of other FAQs http://www.physci.org/codes/javafaq.jsp#faq - Java/Javascript/Powerbuilder HOWTO (Real Gagnon) http://www.rgagnon.com/howto.html - Java Glossary (Roedy Green) http://www.mindprod.com/jgloss.html - jGuru jFAQs (John Zukowski) http://www.jguru.com/jguru/faq/ - Focus on Java (John Zukowski) http://java.about.com/ - Java Q&A (David Reilly) http://www.davidreilly.com/jcb/faq/ - Java GUI FAQ (Thomas Weidenfeller) http://www.physci.org/guifaq.jsp comp.lang.java.help Set-up problems, catch-all first aid. According to its charter, this unmoderated group is for immediate help on any Java problem, especially when the source of the difficulty is hard to pin down in terms of topics treated on other groups. This is the appropriate group for end-users, programmers and administrators who are having difficulty installing a system capable of running Java applets or programs. It is also the right group for people trying to check their understanding of something in the language, or to troubleshoot something simple. comp.lang.java.programmer Programming in the Java language. An unmoderated group for discussion of Java as a programming language. Specific example topics may include: o types, classes, interfaces, and other language concepts o the syntax and grammar of Java o threaded programming in Java - sychronisation, monitors, etc. o possible language extensions (as opposed to API extensions). The original charter said that discussion explicitly should not include API features that are not built into the Java language and gave examples like networking and the AWT. These days AWT belongs in clj.gui, and networking (and many other APIs) are often discussed in clj.programmer. Do not post binary classfiles or long source listings on any of these groups. Instead, the post should reference a WWW or FTP site (short source snippets to demonstrate a particular point or problem are fine). For some problems you might consider posting a SSCCE (Short, Self Contained, Correct (Compilable), Example); see http://www.physci.org/codes/sscce.jsp Don't post on topics that have their own groups, such as: comp.lang.java.3d The Java 3D API comp.lang.java.advocacy Arguments about X versus Y, for various Java X and Y comp.lang.java.beans JavaBeans and similar component frameworks comp.lang.java.corba Common Object Request Broker Architecture and Java comp.lang.java.databases Using databases from Java comp.lang.java.gui Java graphical user interface design and construction comp.lang.java.machine Java virtual machines, like JVM and KVM comp.lang.java.security Using Java securely comp.lang.java.softwaretools Tools for developing/maintaining Java programs Don't cross-post between these groups and c.l.j.programmer or .help -- it just wastes the time of people reading the general groups. Don't post about JavaScript; it's a different language. See comp.lang.javascript instead. -- "Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5 http://www.cs.queensu.ca/~dalamb/ qucis->cs to reply (it's a long story...) ========================================================================== TOPIC: setObject / getSpecificObject - when to type check? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee5079d0a646ebb ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 2:40 am From: "Chris Uppal" <[EMAIL PROTECTED]> VisionSet wrote: > A bit bloaty for every subclass, but sensible? > Since setRecord() is public then perhaps I should, otherwise a bit OTT? I think you are getting your OO responsibilities into a bit of a twist. Lets take it a step at a time. Start with a few example classes: class Fruit {} class Apple extends Fruit {} class Fructivore { void eat(Fruit fruit) { ... } } Ok, so an instance of Fructivore can eat() an Apple. So far so good. Now introduce a couple of subclasses in the sort of pattern you are contemplating (which I am not criticising, btw): class Strawberry extends Fruit class Penelope extends Fructivore { void eat(Fruit fruit) { if (! fruit instanceof Strawberry) { // everybody knows that Penelopes // only eat strawberries ! // (NB: unchecked exception) throw new ICantEatTHATException(); } super eat(fruit); } } The problem is that Peneolpes break the contract established by Fructivore -- they cannot be used anywhere that a Fructivore can. Now that may not matter, especially for package-private code. You may not have intended Penelopes to be substitutable for Fructivores. In which case you were just using Fructivore as a useful place to inherit /code/ from, not /type/ (and would presumably have expressed it as private inheritance if you'd been using a language with that feature, such as C++). But if that isn't the case -- if you do intend Penelopes to inherit the /type/ of Fructivore -- then you have a problem. You have, whether you wanted to or not, changed the contract that users of Fructivore see (even if they know nothing of Penelopes), so why not change the code to reflect that. At minimum, ICantEatTHATException should be a checked exception declared by Fructivore.eat(), but that doesn't really help with your problem. I'd rather go further and move the responsibility for checking into the superclass: class Fructivore { final void eat(Fruit fruit) throws CannotEatException { if (!canEat(fruit)) throw new CannotEatException(); .... } public /* or protected */ boolean canEat(fruit) { return true; } } class Penelope extends Fructivore { public /* or protected */ boolean canEat(fruit) { // everybody knows that Penelopes // only eat strawberries ! return fruit instanceof Strawberry; } } The check method isn't restricted to testing the class, of course; it'd be just as reasonable for Penelopes to check fruit.isNotMouldy() or fruit.isExpensive(). I suspect that your instincts weren't really responding to the "OTT" checking in the subclass, so much as the misalignment of responsibilities that it implied. If you code it something like the above, then I don't think the runtime check in the subclass (which will be coded as an explicit check method, not as a hacky override of the superclasses setter) will seem OTT at all. -- chris ========================================================================== TOPIC: Contructor bad practices----WAS: Re: Can someone use invokeLater()... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 2:38 am From: "Chris Uppal" <[EMAIL PROTECTED]> Thomas G. Marshall wrote: > [...] still something not quite right, > lemme state it better: > > Given class A, helper() and B, helper() (in standard examples) > > javac cannot tell with certainty whether or not the A() is calling > helper() but it /can/ determine so to a first approximation. To avoid > having to actually sniff the byte code, javac could maintain a list of > the overridable methods /actually called/ by A(), which by the way, may > happen (enough so) already---I'm not sure what the symbol table looks > like in .class files. I'm not certain what you're saying here, so I may be addressing the wrong topic, but.. (Just FYI, a classfile contains enough information that you can tell which methods are invoked without parsing the bytecode itself. However you can't tell /which/ method(s) the call(s) are issued from, only that /some/ method does so somewhere. That can be a useful optimisation -- you can identity classfiles on the basis of a quick scan using just the coarse cross-reference information in the 'Constants Pool', and then use slower bytecode parsing to look in more detail at the classes identified by the first pass.) My feeling is that it is not the job of the /complier/ to do this sort of global analysis (indeed I think it does too much of that already). However global analysis can find such cases quite easily. The tightest condition I can think of: If any field of any object has not been initialised (according to the rules for "definite assignment") when some method call, m(), is made from a constructor. And if that field is subsequently set in that constructor. And if m() or any method that can directly or indirectly be called by m() reads or writes that field, then there is a possibility of error. If you weaken the condition to remove the "definite assignment" bit, then that becomes quite tractable. In fact it will make a great use-case for some tooling that I am slowly putting together for this kind of stuff. (It particularly good because it's too complex to hard-wire as a primitive "query", but useful enough to be something that you'd want to be able check nevertheless.) But note that it would still be prone to false-positives. For instance, code like this: public class MyClass { private Object m_datum1; private Object m_datum2; private Object m_datum3; public MyClass() { reset(); } public MyClass(String aString) { this(); m_datum2 = computeSomethingFrom(aString); } public void reset() { m_datum1 = //... m_datum2 = //... m_datum3 = //... } } which avoids duplication of the initialisation logic by calling the public (and legitimately overridable) reset() method, would show up as "dangerous". (Which it is, a little, but not so much so -- IMO -- as if it duplicated the initialisation logic.) -- chris ========================================================================== TOPIC: Example of misusage of exceptions. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/994f4051b1f6692c ========================================================================== == 1 of 2 == Date: Mon, Nov 1 2004 3:04 am From: [EMAIL PROTECTED] (Nicolai Hansen) "Skybuck Flying" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hello, > > First I like to say I appreciate that this person has made a website about > adaptive huffman compression and even supplied some code. > > However the code is pretty shocking ;) and a good example of misusage of > exceptions... probably because out of lazyness ;) > > http://www.cs.sfu.ca/cs/CC/365/li/squeeze/AdaptiveHuff.html > > This person/code is using/throwing exceptions instead of returning a boolean > value as I think that he should have done in the first place. > > The first function tries to find a character if it can't find it it simply > (?!) throws an exception. > > The second function tries to find a tree node with a certain frequency if it > doesn't find it it also throws an exception. > > The update tree method has a try catch block... this whole construction > obfuscates the logic path quite considerably... > > For example at first glance it looks like the 'catch' block can be 'entered' > from both functions... in reality however the second function will always > find the frequency... so the programmer did not clearly express that in the > code. > > > // two functions from other class. > > /** > * findChar > * > * Returns the index of the character > * > */ > > public int findChar (char letter) throws NoSuchElementException > { > > for (int i=0; i < 2*ALPH_SIZE; i++) { > if (tree[i].letter == letter) return i; > } > > throw new NoSuchElementException(" in findChar"); > } > > /* > * HighestInBlock > * > * Returns the value of the node that is the highest in the block > * i.e. of all nodes with the same count > * > */ > > public int highestInBlock (int count) > { > > int highest = -1; > > for (int i=0; i < 2*ALPH_SIZE; i++) > { > if (tree[i].count == count) highest=i; > } > > if (highest == -1) throw new NoSuchElementException("No such node > with count of " + count); > > return highest; > } > > > public void updateTree(char newchar) > { > int current; > int max; > > > try { // first appearance for > symbol > current = findChar(newchar); // Go to symbol external > node > > // could enter catch block ?! yes > > max = highestInBlock(tree[current].count); // Node number max in > block? > > // could enter catch block ?! probably not ! > > if (current != max && tree[current].parent != max) { > addMessage(" Swapping nodes " +current+ " and " +max); > swap(current, max); // Switch node with > highest node in block > pause(); > current = max; > } > addMessage(" Increasing count for '" +newchar+ "'"); > tree[current].count++; // Increment node weight > pause(); > > > } catch (NoSuchElementException e) { // Yes > addMessage(" Spawning new node for '" +newchar+ "'"); > current = spawn(newchar); // NYT gives birth to > new NYT and external node > current = tree[current].parent; // Go to old NYT node > tree[current].count++; // Increment count of > old NYT node > pause(); > > } > > while (current != root) // Is this the root > node? > { > current = tree[current].parent; // Go to parent node > > // no exception handling at all ? > > max = highestInBlock(tree[current].count); // Node number max in > block? > > // no exception handling at all ? > > if (current != max && tree[current].parent != max) { > addMessage(" Swapping nodes " +current+ " and " +max); > swap(current, max); // Switch node with highest node > in block > pause(); > current = max; > } > > tree[current].count++; // Increment node weight > > } > > drawTrie(dispRect, null); > > } > > Pretty lazy isn't it ?!? > > Bye, > Skybuck. 1. This is Java (ie wrong NG) 2. No, it's pretty smart code. Notice that many of the methods has a return value. When they have a return value they can not also return a boolean. Instead they throw an exception, telling the caller that they have finished without a result. The exception tells the caller what the problem was, and this is handled by the caller (in the catch block). == 2 of 2 == Date: Mon, Nov 1 2004 3:07 am From: [EMAIL PROTECTED] (Nicolai Hansen) I could see this one was posted to both Delphi and Java NGs. My wrong NG comment was of course only meant for the Delphi NG ;) ========================================================================== TOPIC: Another jar problem ... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/689cb4b9d924d27f ========================================================================== == 1 of 5 == Date: Mon, Nov 1 2004 4:55 am From: "Stéphanie Vanhove" <[EMAIL PROTECTED]> Hello, When I want to jar a file, the lines in the manifest file never seem to be added to the manifest! I type in the command line in DOS: jar cfm HelloWorld.jar manifest *.class And the file "manifest" contains the line Main-Class: HelloWorld When I try to run this (java -jar HelloWorld.jar) I get the following error: "Failed to load Main-Class manifest attribute from HelloWorld.jar" And indeed, when I unzip the jar file and check the manifest, the line "Main-Class: HelloWorld" was never added to it ... Does anyone know what I am doing wrong ?? Thanks! == 2 of 5 == Date: Mon, Nov 1 2004 5:26 am From: "Yogo" <n o s p a m> "Stéphanie Vanhove" wrote: ... > > And the file "manifest" contains the line > > Main-Class: HelloWorld > ... > And indeed, when I unzip the jar file and check the manifest, the line > "Main-Class: HelloWorld" was never added to it ... I think you need to add a blank line after the line Main-Class: HelloWorld Yogo == 3 of 5 == Date: Mon, Nov 1 2004 5:39 am From: "Stéphanie Vanhove" <[EMAIL PROTECTED]> Indeed, that was the problem :$ Thank you very much! "Yogo" <n o s p a m> schreef in bericht news:[EMAIL PROTECTED] > "Stéphanie Vanhove" wrote: > ... > > > > And the file "manifest" contains the line > > > > Main-Class: HelloWorld > > > ... > > And indeed, when I unzip the jar file and check the manifest, the line > > "Main-Class: HelloWorld" was never added to it ... > > I think you need to add a blank line after the line Main-Class: HelloWorld > > > Yogo > > == 4 of 5 == Date: Mon, Nov 1 2004 5:42 am From: "Chris Uppal" <[EMAIL PROTECTED]> Stéphanie Vanhove wrote: > And indeed, when I unzip the jar file and check the manifest, the line > "Main-Class: HelloWorld" was never added to it ... Does your source "manifest" file have a carriage-return / line-feed at the end of that line, or is it the last line of the file and terminated by the end-of-file ? The jar tool ignores the last line of the input file unless it ends with a line-feed (or line-feed / carriage-return pair). (Does anyone know if that particular idiocy has been fixed in 1.5 ? I'm too lazy/pessimistic to go check...) -- chris == 5 of 5 == Date: Mon, Nov 1 2004 6:44 am From: "Stéphanie Vanhove" <[EMAIL PROTECTED]> now another problem is that when I try to run the jar file, I get nullpointer exceptions (probably due to the images I 'm using) The images are in the jar file, and this is how I declare them: URL image = MyClass.class.getResource("image.gif"); However this doesn't seem to be working ... any ideas? Sorry about the questions, it 's the first time I 'm trying to do this .. "Stéphanie Vanhove" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Hello, > > When I want to jar a file, the lines in the manifest file never seem to be > added to the manifest! > > I type in the command line in DOS: > > jar cfm HelloWorld.jar manifest *.class > > And the file "manifest" contains the line > > Main-Class: HelloWorld > > When I try to run this (java -jar HelloWorld.jar) I get the following error: > > "Failed to load Main-Class manifest attribute from HelloWorld.jar" > > And indeed, when I unzip the jar file and check the manifest, the line > "Main-Class: HelloWorld" was never added to it ... > > Does anyone know what I am doing wrong ?? Thanks! > > ========================================================================== TOPIC: integration java and vb.net? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7a6d56a9aec179f ========================================================================== == 1 of 2 == Date: Mon, Nov 1 2004 5:24 am From: "bilian" <[EMAIL PROTECTED]> i m new to this forum. i have an question that is --> Is there an integration between java and vb.net? I plan to do an application which can 1. transfer files between client and server 2. all the files will be printed when transferring is finish 3. server will get all the file info and save it to database i more prefer use java but i think if do application communicate with OS, use vb.net will easier at some part. any comment or advices? thanks... == 2 of 2 == Date: Mon, Nov 1 2004 5:40 am From: "Stefan Schulz" <[EMAIL PROTECTED]> On Mon, 01 Nov 2004 08:24:32 -0500, bilian <[EMAIL PROTECTED]> wrote: > i m new to this forum. > i have an question that is --> > Is there an integration between java and vb.net? I plan to do an > application which can > 1. transfer files between client and server > 2. all the files will be printed when transferring is finish > 3. server will get all the file info and save it to database > > i more prefer use java but i think if do application communicate with OS, > use vb.net will easier at some part. > any comment or advices? I would suggest you pick one language and stick with it. :) Java does interact with the OS regularly (whenever you do anything but pure computation, in fact), but it does so transparently (for the most part, at least). While i can not recommend one language above the other, mixing two without excellent reason to do so is almost always a bad idea. -- Whom the gods wish to destroy they first call promising. ========================================================================== TOPIC: flush attribute in JSP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c3cec6d3c4756ac ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 5:24 am From: kaeli <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] enlightened us with... > I want to know what is the usage of flush attribute? For example, > whats the differences in the following? > > <jsp:include page="header.jsp" flush="true"/> > <jsp:include page="header.jsp"/> > > please help. thanks!! > >From docs: flush="true | false" If the page output is buffered and the flush attribute is given a true value, the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is false. See this page for more explanation (#2 especially): http://java.oreilly.com/news/jsptips_1100.html Basically, if you flush it too soon, you can't redirect or set headers. This means if you're using error pages, they won't forward after the response is commited, so you better put stuff in a try/catch. :) -- -- ~kaeli~ To steal ideas from one person is plagiarism; to steal from many is research. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace ========================================================================== TOPIC: JSP Struts <logic:equal> tag questions http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/135efce4ed8c9cd ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 5:36 am From: [EMAIL PROTECTED] (Greg Smith) randall, i recently started a thread along this line... http://groups.google.com/groups?q=g:thl2472657007d&dq=&hl=en&lr=&selm=ac6ab9b0.0410140717.4146e11f%40posting.google.com the answer to your question is that there is no easy way to do this in struts. however, jstl is a taglib with much better control structures. i've not used jstl in conjunction with struts. perhaps you could try it and report back your success with it. greg ========================================================================== TOPIC: tomcat 4.1.30 and not recognizing new compiled code http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d037203a155ce61f ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 5:25 am From: "William Brogden" <[EMAIL PROTECTED]> On Sun, 31 Oct 2004 15:54:53 -0500, Ryan <[EMAIL PROTECTED]> wrote: > Doesn't happen every time. I close my browser(using IE) and re-open. I > execute the same code. I am finding I have to frequently shut down and > restart the web server in order to get it to notice my new code? > > I use the Tomcat manager webapp to force reloading of the entire web application. It is documented in your tomcat installation. Bill ========================================================================== TOPIC: Does this finally get executed ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e0d9fa26e656cf72 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 5:52 am From: "John C. Bollinger" <[EMAIL PROTECTED]> VisionSet wrote: > "GIMME" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Psuedo code ... >> >>Does sc.close() get executed ? >> >>public static Employee get(int id ) throws Exception >>{ >> try { >> SomeConnection sc = new SomeConnection(); >> return new Employee(); >> }finally { >> sc.close(); >>} > > > Yes, finally is always executed. > I think the only exception is calling System.exit(0) Which is because System.exit() does not return. I imagine one could work up an example involving the (deprecated!) Thread.stop() method. Both cases revolve around the thread ceasing to run before getting around to executing the finally block, which is the only general way I can think of that the finally block would not be executed. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Struts iterate indexed nested objects http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4308a477a108f808 ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 6:01 am From: [EMAIL PROTECTED] (Stratocaster) Hi all, I have a fairly simple problem, but can not seem to figure out whats going on. Here is what I'm try to do. I have an object hierarchy like this: AForm |_>B (Array of B) |_>C (Array of C) I need to create an input form from this. AForm is the struct ActionForm. AForm contains an array of B and B contains an array of C. B and C are just regular class objects. They contain two instance vars each. Here is a snippet of the jsp: <logic:iterate id="aB" name="AForm" property="B"> <html:text indexed="true" name="aB" property="aBVar1"/> <html:text indexed="true" name="aB" property="aBVar2"/> <logic:iterate id="aC" name="aB" property="C"> <html:text indexed="true" name="aC" property="aCVar1"/> <html:text indexed="true" name="aC" property="aCVar2"/> </logic:iterate> </logic:iterate> I prepopulate the data before the form is presented. The above jsp works fine for displaying the data (struts doesn't complain). The text boxes contain the data. But when I submit the form the Array of C of object B is lost. Just not there. It was there when I sent it down, but not on the submit back. Here is what the HTML thats generated looks like. Looks like its missing the parent object references: <input type="text" name="aB[0].aBVar1" value="ONE B"> <input type="text" name="aB[0].aBVar2" value="TWO B"> <input type="text" name="aC[0].aCVar1" value="ONE C"> <input type="text" name="aC[0].aCVar2" value="TWO C"> It looks like there is a reference to the parent missing. Like name="aB[0].aC[0].aCVar1" Perhaps I don't have my iterates set up correctly. Any help would be greatly appreciated! Carmine ========================================================================== TOPIC: applet's call comportement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 6:28 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Emmanuel Freund wrote: > Well, the AWT toolkit's environnement don't match the things i want to > render. But i aggree it would be simpler in this way. The AWT toolkit is the base on which everything else is built. It necessarily matches what you want to render, or you won't render it with AWT / Swing. Now, you may not _see_ how things in the Toolkit match up; if you want a Toolkit-based approach to work you will need to learn how the classes you are interested in (JFrame, and perhaps others) use the Toolkit, directly or indirectly. For help with this kind of task you might want to go next door to comp.lang.java.gui. > I'm just wondering, when an applet call the JFrame class for example, there > has to be somewhere the path where the applet could find this class, so if > we change the path toward my own class, the applet will call my own class > instead, no? even if my own class is a child of JFrame? unless i've really > none understand, which is a possibility... As I wrote before, you would do this by bringing a custom ClassLoader into the picture. ClassLoaders are *the* means by which Java VMs find classes after bootstrap. It might be appropriate to use an applet-specific ClassLoader anyway, to isolate external applets' classes from your application's own. Trying to use one to substitute your own version of a class for the System's version raises all the problems I described to you before. In particular, here is a schematic example of why you cannot use a ClassLoader to substitute a class for one of its ancestors: 1) applet com.sombodyelse.MyApplet wants to open a JFrame, so it asks its ClassLoader to load javax.swing.JFrame for it. 2) A custom ClassLoader intercepts the request, and instead of passing it first to its parent ClassLoader (as a "normal" ClassLoader would do) it finds and starts to load a class file for a class named com.mycompany.myapplication.MyFrame to satisfy the request. 3) MyJFrame needs its superclass, javax.swing.JFrame, so it asks its ClassLoader to load that class for it. 4) Go to (2), or throw a ClassCircularityError. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: A question to parse HTML files http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5792f3bd809986a ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 6:52 am From: [EMAIL PROTECTED] (mike) regards: Can I use java xml api or any other xml parser or other xml tool to parse HTML file? thank you best wishes ========================================================================== TOPIC: stack implementation http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c909f1ce5b4696a ========================================================================== == 1 of 1 == Date: Mon, Nov 1 2004 6:56 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Boudewijn Dijkstra wrote: > "Tor Iver Wilhelmsen" <[EMAIL PROTECTED]> schreef in bericht > news:[EMAIL PROTECTED] >>it, etc. Ideally I would write my own implementation using a >>LinkedList as an internal representation. > > > Something like this perhaps? [Complete stack implementation including custom linked list implementation snipped] Based on the fact that he specifically named the LinkedList class, I suspect Tor meant something more like this: public class BetterStack { List elements = new LinkedList(); public void clear() { elements.clear(); } public void push(Object o) { elements.add(o); } public Object pop() throws StackEmptyException { try { return elements.remove(elements.size() - 1); } catch (IndexOutOfBoundsException ioobe) { throw new StackEmptyException(); } } public Object peek() throws StackEmptyException { try { return elements.get(elements.size() - 1); } catch (IndexOutOfBoundsException ioobe) { throw new StackEmptyException(); } } public int getSize() { return elements.size(); } public boolean isEmpty() { return (elements.isEmpty()); } } Everyone enjoys reinventing the wheel, but their boss would usually prefer that they just put the manufacturer's wheel on the car. John Bollinger [EMAIL PROTECTED] ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
