This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
A very strange thing happen in my html/servlet. I had a html page that take user's input and than the servlet save into database. When the input contains a "/", it interpret as a "a". For example, I put "hong_zhang/email", it will display as "hong_zhangaemail". I user websphere as the server and oracle database. Any idea to help me out this weird situation? Thanks in advance. Hong
Brian Glodde
Ranch Hand
Joined: Jun 27, 2001
Posts: 171
posted
0
You might try placing an escape character in front of the forward slash ""hong_zhang\/email". This tells java to consider the next character as a literal.
hong zhang
Ranch Hand
Joined: Jun 07, 2001
Posts: 30
posted
0
Brian, I tried and with no luck. I input "hong_zhang\/email" and the result is "hong_zhangaaemail" the "\" escape character interpret as "a" with a tail on top of it. Any ideas?
Originally posted by Brian Glodde: You might try placing an escape character in front of the forward slash ""hong_zhang\/email". This tells java to consider the next character as a literal.
Malhar Barai
Author
Ranch Hand
Joined: Aug 17, 2001
Posts: 399
posted
0
nope buddy, but if u get the solution, do write it to me, coz the prob sounds great enough to ponder good luck malhar
where do you find your input was changed. At the point when your servlet get it, like [ String str = request.getParameter("url"); System.out.println(str); ] or you get it on the feedback page ?
hong zhang
Ranch Hand
Joined: Jun 07, 2001
Posts: 30
posted
0
Jim, I find it out in the request.getParameter. In the servelet I did: PrintWriter out; res.setContentType("text/html"); out = res.getWriter(); Is there something on WebSphere did not setup correctly? Or I missed somthing? I use the same code and run on Tomcat, it runs fine. Any idea will be very much appreciated.
Originally posted by Jim Wang: where do you find your input was changed. At the point when your servlet get it, like [ String str = request.getParameter("url"); System.out.println(str); ] or you get it on the feedback page ?
Jim Wang
Ranch Hand
Joined: Oct 04, 2001
Posts: 41
posted
0
My server is Tomcat too. If you are sure this thing happened before your servlet get the input. You may test it on different browsers to whether you need to correct your setting. Another way is use a javascript function change '/' to a rarely used charactor. It's not a good solution, but it may make your code work. J
hong zhang
Ranch Hand
Joined: Jun 07, 2001
Posts: 30
posted
0
Jim, Thanks for your reply. I still have no clue why the browser doesn't take "/" and interpreted as "a". In fact, it doesn't take any special character, like "%", "!", "$", etc. I need that "/" in the field as it is used as email address. How I use javascrip to accomplish it. Could you elaberate a little more, or possibly give some examples. Thanks, Hong
Frank Lin
Ranch Hand
Joined: Jan 26, 2001
Posts: 76
posted
0
Hong, The problem might have something to do with websphere setup. Check the code page or code set setting.
hong zhang
Ranch Hand
Joined: Jun 07, 2001
Posts: 30
posted
0
Originally posted by Frank Lin: Hong, The problem might have something to do with websphere setup. Check the code page or code set setting.
Frank, Thanks for your reply. I thought it was websphere issue, but I just don't know where to start. You mention about the "code page" or "code set" setting, could you explain more in detail. I'm not familiar with websphere admin, only use it as the web application server. The person set up did not have clue about the problem. Thanks in advance. Hong