• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in html

 
hong zhang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope buddy,
but if u get the solution, do write it to me, coz the prob sounds great enough to ponder
good luck
malhar
 
Jim Wang
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hong,
The problem might have something to do with websphere setup. Check the code page or code set setting.
 
hong zhang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A "Code Page" is a mapping of bits onto an alphabet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic