Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 21st, 2002, 12:49 AM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 27 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 27 m 49 sec
Reputation Power: 0
passing unusual text

I'm really new to JSP, but my partner has been working with it for quite awhile. He's encountered a problem that I believe can be addressed easily, but I can't find anything about this in the books, and I'm not quite sure what I need to look for.

We're passing serveral parameters to the next window as part of an sql "where" clause to select data based upon the criteria selected. It works great until we select criteria with certain characters, such as the British currency sign.

The temporary solution is to go through the data and make sure we bypass any fields with these characters, NOT a good solution, but neither of us can figure out a permanent solution, since it's not a good idea to have to sift through the data and figure out the hexadecimal for each and every possible non-alphanumeric character so that it doesn't trash our stuff.

Any ideas or suggestions are most welcome. Thank you so much for you time.

Kind regards,
Pat Flickner

Reply With Quote
  #2  
Old May 21st, 2002, 01:38 PM
aabha aabha is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: India
Posts: 7 aabha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to aabha
there is a class called URLEncode to care of all these encoding...
try using it...



--aabha

Reply With Quote
  #3  
Old June 2nd, 2002, 12:53 PM
science science is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 2 science User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to science
in the first place, such signs should not exist in the database or front end.

But anyway I believe you can look at things like itemID. Try implementing a ID field in yer database as autonumber so that you can set your desc to be anything.

Reply With Quote
  #4  
Old June 4th, 2002, 05:04 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 27 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 27 m 49 sec
Reputation Power: 0
Unhappy

Thanks for the urlencode, but it turns out it's no good on anything less than MSIE 5.5, and with the pace at which our other markets move, it could be another year before they upgrade, so we're stuck. We did try it, it works, but we had to pull it when we found out that not everyone is even at 5.0 yet.

As for the response about "such signs should not exist," yes, actually, they should be allowed. This is data we're talking about, real, honest-to-goodness data that the clients expect to see. And since we cater to the customer, their wish is our command. But if you could explain what you mean by setting up an ID field, I would love to hear it. Since we can't use the first method, yours sounds like it might be the next best thing.

Thank you both for your replies.

Kind regards,

Pat Flickner

Reply With Quote
  #5  
Old June 5th, 2002, 07:13 AM
Waltjp's Avatar
Waltjp Waltjp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: NJ, USA
Posts: 91 Waltjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 8 sec
Reputation Power: 11
Quote:
Originally posted by pflick
As for the response about "such signs should not exist," yes, actually, they should be allowed. This is data we're talking about, real, honest-to-goodness data that the clients expect to see. And since we cater to the customer, their wish is our command.


Is this currency appearing within a string of text or is it a stand-alone field? If the field contains a value only then the currency symbol should not be included.

Reply With Quote
  #6  
Old June 5th, 2002, 03:17 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 27 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 27 m 49 sec
Reputation Power: 0
Yes, it is currency, but we have no way of knowing what the data will contain until we get an error. And removing any symbols for java causes the results to not appear because they are data entered by the customer with the symbols. (The first page allows subsetting -- we do not hard-code everything. It's a fully data-driven design which is controlled by the DBA.) So you can see my dilemma.

Reply With Quote
  #7  
Old June 5th, 2002, 04:24 PM
Waltjp's Avatar
Waltjp Waltjp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: NJ, USA
Posts: 91 Waltjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 8 sec
Reputation Power: 11
Quote:
Originally posted by pflick
Yes, it is currency, but we have no way of knowing what the data will contain until we get an error. And removing any symbols for java causes the results to not appear because they are data entered by the customer with the symbols. (The first page allows subsetting -- we do not hard-code everything. It's a fully data-driven design which is controlled by the DBA.) So you can see my dilemma.


I think the solution may be in using a method of the String class. Could you share your code and let me know where the errors are occurring and with an example of the data that's causing the error?

Reply With Quote
  #8  
Old June 11th, 2002, 02:57 PM
dhtmlkitchen dhtmlkitchen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Boston, MA
Posts: 30 dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 55
Code:
java.net.URLEncoder.encode(String s)

java.net.URLDecoder.decode(String s)


Download this :http://java.sun.com/j2se/1.3/docs/api/index.html
__________________
http://dhtmlkitchen.com/

Reply With Quote
  #9  
Old June 12th, 2002, 06:46 AM
science science is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 2 science User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to science
Quote:
Originally posted by pflick
Thanks for the urlencode, but it turns out it's no good on anything less than MSIE 5.5, and with the pace at which our other markets move, it could be another year before they upgrade, so we're stuck. We did try it, it works, but we had to pull it when we found out that not everyone is even at 5.0 yet.

As for the response about "such signs should not exist," yes, actually, they should be allowed. This is data we're talking about, real, honest-to-goodness data that the clients expect to see. And since we cater to the customer, their wish is our command. But if you could explain what you mean by setting up an ID field, I would love to hear it. Since we can't use the first method, yours sounds like it might be the next best thing.

Thank you both for your replies.

Kind regards,

Pat Flickner


Hi,

What do you mean by url encode does not work on anything less than IE 5.0. I thought its a server side thing...but anyway on the ID field.

Use a unique ID to uniquely identify each item in your database row. Let the ID be an autonumber too

Reply With Quote
  #10  
Old June 12th, 2002, 11:10 AM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 27 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 27 m 49 sec
Reputation Power: 0
URLencode is through javascript, which is client-side. We just (last night) found another item accidentally when we were researching the issue: escape(). (There's a noescape() as well.) The ecapse() function seems to handle the situation quite nicely. We're doing some further tests over the next few days, so I'll let you know.

Reply With Quote
  #11  
Old June 12th, 2002, 02:01 PM
dhtmlkitchen dhtmlkitchen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Boston, MA
Posts: 30 dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level)dhtmlkitchen User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 55
Question

Spreading the logic between java and javascript is not a good idea in this case. I don't see why you would use javascript. Keep it simple. Stick with Java.

You might find it useful to make a utility class. This can help you avoid too much java code in your pages, meaning less maintenance and work.

Start by adding this to your scriptlet:
Code:
java.net.URLDecoder.decode(value);



Then take look at your code, it's objective, and write yourself a utility method.

Reply With Quote
  #12  
Old June 12th, 2002, 02:53 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 27 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 27 m 49 sec
Reputation Power: 0
Thanks. We'll do that. I appreciate everyone's help very much.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > passing unusual text

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap