comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Calling a C++ dll from Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb34fe9b438a1547 * Regexp to extract filename from g++ output - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d495dd5db4858206 * refined 2D design question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe2ce27adc5ec49a * Help with regular expression? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6df7001ce71f68e7 * JSP web hosting companies? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b174e4eeec12692 * How to change 3 to "003" - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f04fef73a25ccc0 * DAO pattern - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ba356da99ce3584f * 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 get KeyPressed event inside JWindow - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26a3c33df985c317 * client-server architecture questions - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90db3ddcbd22e71e * Good JSP 2.0 Book? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/23bfc11924c6feb3 * 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 * looping in ant scripts - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8de4ddc04064a17 * Java was created in SODOM and GOMORRAH !!!! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/241d795807847c94 * JSP JavaBeans problem in scope="session" attribute - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 * 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 ============================================================================== TOPIC: Calling a C++ dll from Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb34fe9b438a1547 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 11:48 pm From: Tilman Bohn [f'up2 cljp] In message <[EMAIL PROTECTED]>, Robert kebernet Cooper wrote on 19 Dec 2004 15:35:19 -0800: [...] > http://www-106.ibm.com/developerworks/library/j-intbridge/ This looks very interesting, I hadn't known about that! Could come in very handy indeed in an upcoming project, so thanks from me for that pointer! -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright ============================================================================== TOPIC: Regexp to extract filename from g++ output http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d495dd5db4858206 ============================================================================== == 1 of 4 == Date: Mon, Dec 20 2004 11:53 pm From: "Virgil Green" Virgil Green wrote: > 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]):|)(\\\\|/)[^:]+ Oops again... no need to test for the differing slashes... ([a-zA-Z]:|)[^:]+ - Virgil == 2 of 4 == Date: Tues, Dec 21 2004 12:01 am From: "Virgil Green" Tilman Bohn wrote: > 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. 1. Oh... thanks. I just play with regexes occasionally. Nice to know that. 2. Haven't a clue. Wasn't my original problem. But I did post a later version when I realized I didn't need to check for the slashes. 3. That occurred to me when I was thinking about not needing to test for slashes. Spaces are valid too, right? So, is it possible to extract the file name accurately with a regex given that the text message could contain any number of colons and spaces? I'm hard pressed to think of a pattern that would match if you can't rely on a colon or a space as a terminator. Something for me to mull over. - Virgil == 3 of 4 == Date: Tues, Dec 21 2004 12:33 am From: Tilman Bohn In message <[EMAIL PROTECTED]>, Virgil Green wrote on Tue, 21 Dec 2004 00:01:39 GMT: [...] > 1. Oh... thanks. I just play with regexes occasionally. Nice to know that. You're welcome. ;-) (Not that I'm a regexp-wizard myself, mind you.) > 2. Haven't a clue. Wasn't my original problem. But I did post a later > version when I realized I didn't need to check for the slashes. Our posts must've crossed, I haven't seen that message yet, I only saw the one with the correct Java Backslash-Escaping. > 3. That occurred to me when I was thinking about not needing to test for > slashes. Spaces are valid too, right? Yup. On Unix, Windows and MacOS. > So, is it possible to extract the file > name accurately with a regex given that the text message could contain any > number of colons and spaces? I'm hard pressed to think of a pattern that > would match if you can't rely on a colon or a space as a terminator. I don't think it's possible. Actually at this point I don't even think it's possible if one tests for the platform-specific separator and then proceeds accordingly, because of the optional column output... However, if one can assume that all file names will end in .cpp (in any case combination, as Windows is case-insensitive) one might get close enough FAPP. This can then of course easily break, but if it's well-documented it could be acceptable. > Something for me to mull over. Have fun! I have to go get some sleep now and will check the group for your solution first thing in the morning! ;-) -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright == 4 of 4 == Date: Tues, Dec 21 2004 12:10 am From: Gordon Beaton On Tue, 21 Dec 2004 00:01:39 GMT, Virgil Green wrote: > 3. That occurred to me when I was thinking about not needing to test > for slashes. Spaces are valid too, right? So, is it possible to > extract the file name accurately with a regex given that the text > message could contain any number of colons and spaces? I'm hard > pressed to think of a pattern that would match if you can't rely > on a colon or a space as a terminator. This works for me, regardless of the filename: (.+):([0-9]+):([0-9]+): (error|warning):(.+) It works because the first group (.+) is greedy, not possesive. So it consumes as much as necessary but leaves enough of the input for the remainder of the expression to match (actually I believe it will initially match the entire expression, then backtrack until the remaining groups match, but I am not a regexp expert). Here's a simple test run: using regexp "(.+):([0-9]+):([0-9]+): (error|warning):(.+)" line 1: 'errors.c:12:13: error: baz' groups: 5 1 (file): errors.c 2 (line): 12 3 (col): 13 4 (type): error 5 (msg): baz line 2: 'error:s .c:12:13: error: gurka' groups: 5 1 (file): error:s .c 2 (line): 12 3 (col): 13 4 (type): error 5 (msg): gurka /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: refined 2D design question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe2ce27adc5ec49a ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 12:03 am From: "Jeff" Last Friday, I posted a question about sorting two dimensional arrays which evoked some great responses on the exact nature of two dimensional arrays in Java. That discussion made me refine what I was trying to accomplish and how. Now I'd like to get other opinions on my new approach. Here's the problem. My input is data that has 4 fields: 1 String, 1 float, 2 ints. The input comes from various other classes - it's not in rows. The String is the subject, the float and ints describe the subject. A separate program eventually puts my output in a 2 dimensional Swing table. Up to 1000 rows can arrive as input, but I want to pass the presenting program only the top 15 rows. The rows with the largest float values are selected for presentation, thus the need to sort the input. One other influence. I typically use Vectors of Vectors to implement my Swing table model. The best solution I can think of is to extend Vector to implement the Comparable interface, creating a class called ComparableVector for each row. In ComparableVector's compareTo() method, I'll compare the float value of each row. Then I can use the Arrays.sort() method to perform the sort. A Vector of ComparableVectors will provide the 2nd dimension. Does someone see a better solution? -- Jeff ============================================================================== TOPIC: Help with regular expression? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6df7001ce71f68e7 ============================================================================== == 1 of 2 == Date: Tues, Dec 21 2004 12:03 am From: Linda Hi, I'm trying to match all strings in my code that aren't in println() statements. What I have tried most recently: [^\Qsystem.out.println\E]\"([^\"])+?\" Help? -L == 2 of 2 == Date: Tues, Dec 21 2004 1:22 am From: Tilman Bohn In message <[EMAIL PROTECTED]>, Linda wrote on Tue, 21 Dec 2004 00:03:22 GMT: > Hi, > > I'm trying to match all strings in my code that aren't in println() > statements. I take it you mean all String literals, not all strings. > What I have tried most recently: > [^\Qsystem.out.println\E]\"([^\"])+?\" The first bracketed expression doesn't do what you think it does. Character classes don't work for character sequences like that, and the \Q...\E escaping doesn't change that. (Your bracket really means `any character but s, y, t, e, m, o, u, p, r, i, n, l, or a dot'.) Also, if it did, the match would include not only your literal, but anything leading up to it. Plus, the class System is spelled with a capital s. You really want to be using a negative look-behind assertion, which in your case would look as follows: (?<!System\.out\.println) (A positive look-behind assertion would be (?<=foo), just for comparison's sake.) Note that this will break if someone has aliased System.out and then calls println() on the alias. Also be careful to allow arbitrary amounts of white-space. This will get pretty involved once you want to correctly exclude println() calls spanning several lines, for which you probably have only two alternatives: actually parse a good deal of Java syntax, or read a whole file at a time and match it as one multi-line expression. Both of these will get fairly complicated, but if you can live with the occasional false positive, the simple look-behind and some additional white-space should get you a good deal closer to the solution. The second part of your proposed solution won't catch double quotes within the literal. But don't just exclude matches to \", because the sequence \\" could again terminate the literal. This problem is very similar to the `Regexp and Pattern.class' thread currently going on here. Deciding how to correctly match variously escaped characters, but not escaped escape sequences... ;-) Of course this type of problem is one of the original reasons for regular expressions, because such classes of sequences are `typical' languages produced by regular (type 3) grammars. (And of course look-behind assertions can technically never be a part of _regular_ expressions, but that's another story...) -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright ============================================================================== TOPIC: JSP web hosting companies? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b174e4eeec12692 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 8:33 pm From: Eric Asberry I recently switched my hosting to http://javaservlethosting.net and have been pretty happy with them so far. -- Eric Asberry http://ericasberry.com ============================================================================== 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: Tues, Dec 21 2004 1:47 am From: Lee Fesperman 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); > } > } I didn't check the docs, but if Java 5 printf() is the same as C, then you can use: System.out.printf("%03d", x); -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ============================================================================== TOPIC: DAO pattern http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ba356da99ce3584f ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 7:02 pm From: Anzime Alexey J.1001958768 wrote: > Hello! > > Question addresses primary to object relation mappers users. > > Does anyone explain me why business objects shouldn't have a dependency on > the persistent layer (DAO objects). Think about switching databases. > I want to exclude business logic from a controller and concentrate it into a > business objects. Methods of the business object > must intensively use DAOs. But it violates this dogma. > > And question: how could I able to write more complicated business methods > without access to DAO objects? Have your business logic classes call handlers that call DAO classes. Handlers may contain additional pre/post DAO logic. > > Thanks. > Sorry for my poor English. > > -- Regards, Anzime ============================================================================== 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: Tues, Dec 21 2004 9:41 am From: JScoobyCed Ian wrote: > 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 > Do you have a RMISecurityManager ? (i.e. System.setSecurityManager(new RMISecurityManager()); ) in your code. You can't load remote classes without it. Now that will mean that you might need to have a java.policy and start your app with the additional parameter -Djava.security.policy=java.policy > 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 > I would say same thing here. The subclasses of UnicastRemoteObject will be first loaded through RMI channel (note: don't take this for 100%, it is the most probable thing I am thinking of) > 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. > Then maybe because here it sees there is no RMI environment, so it loads the classes directly, note the stubs and skeletons. > Does anyone have any advice? Try using a RMISecurityManager > > Thanks, > > Ian > > -- JScoobyCed ============================================================================== TOPIC: how to get KeyPressed event inside JWindow http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26a3c33df985c317 ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 2:01 pm From: "Michael Dunn" "William Zumwalt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] : A JWindow class is my main class (w/o all the title, min, max controls, : etc...) and I've implemented a KeyListener to it. I have a MouseListener : that works fine. But when I add a KeyListener, nothing happens when I : press the keys ... keyPressed(KeyEvent ke) catches nothing. : : Inside the JWindow I have a JPanel which I set the focus to true (cause : I think you have to have focus on a component to get the key). : panel.setFocusable(true), but I still don't see any KeyPressed events : happening. Anyone have any ideas what's going on here. works OK using an undecorated JFrame, instead of a JWindow import java.awt.*; import java.awt.event.*; import javax.swing.*; class Testing extends JFrame implements KeyListener { JLabel lbl = new JLabel(); public Testing() { setSize(400,300); setLocation(200,100); setUndecorated(true); JPanel jp = new JPanel(); jp.add(lbl); jp.setFocusable(true); jp.addKeyListener(this); getContentPane().add(jp); } public void keyPressed(KeyEvent ke) { if(ke.getKeyCode() == KeyEvent.VK_X) System.exit(0);//press x to exit else lbl.setText(""+ke.getKeyChar()); } public void keyTyped(KeyEvent ke){} public void keyReleased(KeyEvent ke){} public static void main(String[] args){new Testing().setVisible(true);} } ============================================================================== TOPIC: client-server architecture questions http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90db3ddcbd22e71e ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 9:04 pm From: "antoine" Hello, I'm planning the migration of a stock trading application from PC based to client/server architecture. let me explain: currently the app. running on a PC connects to: - a Market Data feed server (receives the feed as text and parses it) - an Order sending engine (sends orders and receives messages, as text) the app runs in java, the feed server and order sending engine are third-party. so basically, all happens on the PC: - reception & emission of messages (data & orders) - computation of prices and other financial data - order sending algorithm computation - display of data (moving fast !) and all GUI (buttons, configuration panels, etc...) we have several users, each running one instance (each connecting both to feed & order engine). I'd like to migrate to a more efficient architecture where I'd separate graphics & GUI from computation work. The idea would be to have a single Java server running on one dedicated machine and taking care of all computations, order sending algorithms, etc, with several clients connected to it, which would then only be "terminals" to display market data and send commands to the server via GUI. The idea is to offload the GUI work from the server and improve performances. only the server would be connected to the market feed and order engine. I'm wandering which technology I should use to have clients and server communicate with each other in the most efficient way. The tasks to be implemented would be: - server sends info to update market data on client's GUI (basically values in a JTable) - client modify server parameters through its GUI - client triggers order sending on the server I'm thinking about two options: - using RMI: server invoques methods on the clients, clients invoque methods on the server - implementing a simple text message protocol I'd like to get guru's advice on what would be pros & cons of each method, and what other technique I could use. ultimately, the idea would be to have clients and server in different places (countries), so bandwidth might be an issue. of course reliability is fundamental... Thanks for giving me your advice !! Antoine == 2 of 2 == Date: Mon, Dec 20 2004 9:53 pm From: "Robert kebernet Cooper" Hmm... I tend to try and opt for SOAP over RMI for tier to tier messaging now. No reason you couldn't use that for all your business actions. With regards to streaming price information, though, I suspect you would want something a little more seamless. My inclination would still be to just use and XML output streaming-HTTP of data off the server, deserialize in small packages then update beans to your JTable. It's not as elegant a solution as RMI EventHandlers, I suppose. JMS is the more obvious option in the API stack, but I imagine that becomes a question of performance vs clients, etc. I have had good luck with high-volume message delivery with both JORAM and SwiftMQ (2m+ messages/hour on a mid-range server), but I don't know how much data you are really talking about and I have never really tracked the latency vs throughput there. It might be worth prototyping. I will say this. Building your own protocol, however simple, is always at the very bottom of my list of things to try. I spent time in a shop like that, and it made me want to scream. ============================================================================== TOPIC: Good JSP 2.0 Book? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/23bfc11924c6feb3 ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 12:14 am From: "Hal Rosser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am a fairly experienced programmer. I've predominantly written web > apps using Microsoft technologies and am looking to learn Java Server > Pages 2.0. > > Can anyone recommend a good book? Looking for a book which assumes that > the reader has a web development background - don't need a tutorial on > how/why pages need to be generated dynamically. Need a "how to build > web apps using JSP" type of book.. > > thanks, > here's one http://www.murach.com/books/jsps/index.htm You'll like servlets and jsp better than asp - after a while --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.818 / Virus Database: 556 - Release Date: 12/17/2004 ============================================================================== 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:02 pm From: "Robert kebernet Cooper" I have never worked with JBoss, but you can use the JNDI stuff in your web.xml file thusly: <jndi-link> <jndi-name>java:comp/env/jms-local</jndi-name> <jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory> <init-param java.naming.provider.url="smqp://localhost:4001/timeout=10000"/> </jndi-link> <jndi-link> <jndi-name>java:comp/env/jms-remote</jndi-name> <jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory> <init-param java.naming.provider.url="smqp://other-server.mydomain.tld:4001/timeout=10000"/> </jndi-link> then do a (new InitialContext()).lookup( "java:comp/env/jms-remote"); out of the servlet. I am sure JBoss has some similar factory and provider URL format. ============================================================================== TOPIC: looping in ant scripts http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8de4ddc04064a17 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 10:19 pm From: "sri" this is the way i solved the problem using macrodef task <macrodef name="testing"> <attribute name="moduleName" default="maintainrole"/> <attribute name="moduleTitle" default="maintainrole"/> <sequential> <jar jarfile="${deploy}/[EMAIL PROTECTED]" > <fileset dir="${build}" > <exclude name="com/xxx/pms/web/" /> <include name="com/xxx/pms/ejb/@{moduleName}/**/*.*"/> <include name="com/xxx/pms/lib/@{moduleName}/**/*.*"/> </fileset> <fileset dir="${src}/ejb/@{moduleName}" > <include name="**/*.xml" /> </fileset> </jar> </sequential> </macrodef> <testing moduleName="maintainrole" moduleTitle="RoleModule"> </testing> <testing moduleName="maintainactivity" moduleTitle="ActivityModule"> </testing> thanks for ur reply john thanks for helping me out ============================================================================== TOPIC: Java was created in SODOM and GOMORRAH !!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/241d795807847c94 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 10:53 pm From: [EMAIL PROTECTED] (Bruno Beam) JAVA was written by SATAN in SODOM with help of the ANTICHRIST in GOMORRAH !!! DEMONS added a lot of BLASPHEMY and HERETICS and WITCHES tons of pure SIN !!!! That makes JAVA extremly EVIL and UNHOLY !!!! If you want to use JAVA, you need HOLY WATER, a BIBLE and a CRUCIFIX and only experienced EXORCISTS can master JAVA !!!! ============================================================================== TOPIC: JSP JavaBeans problem in scope="session" attribute http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 11:04 pm From: "J2EEStar" Hi, Try this below steps........ first try to forward the Request/Response Object from test1.jsp page to test2.jsp page. then try to get property as u did. J2EEStar. [EMAIL PROTECTED] wrote: > I use scope="session" in <jsp:useBean id="user" > class="com.proj1.model.User" scope="session"/>, > and I expect the bean name user doesn't need to redeclare in other > pages, > because the bean is available throughout the session. > > User Id = 1234 is shown in test1.jsp, but when the user click the > submit button, then it has error > > Parsing of JSP File '/test/test2.jsp' failed: > /test/test2.jsp(1): "user" is not a defined bean variable on this page > probably occurred due to an error in /test/test2.jsp line 1: > <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> > > test1.jsp > ========= > <jsp:useBean id="user" class="com.proj1.model.User" scope="session"/> > <jsp:setProperty name="user" property="userId" value="1234"/> > <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> > <html> > <head> > </head> > <body> > <form action="test2.jsp" method="POST"> > <input type="submit" value="submit here"> > </form> > </body> > </html> > > test2.jsp > ========= > <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> > any ideas? please advise. > > thanks!! ============================================================================== 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: Tues, Dec 21 2004 12:08 am From: "Andy Fish" "Collin VanDyck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> 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. > No, I'm looking at it in the debugger. I can see that the string is of length 2 characters. Andy > 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 > ============================================================================== 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
