• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Timestamp issue with %20 space.

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends

I am trying to retrieve the timstamp of certain set of records and display in a jsp. here it diplays the timestamp like this 2007-06-16 19:16:57.798.

from this jsp I have to select one record based on timestamp and send it as a input to the next page to retrive some more fields. the problem is, while sending this time stamp as a url parameter it passes the time as
2007-06-16%2019:16:57.798, the space between the date and time is replaced with %20, I want to get rid off this issue, can you please tel me how to send the timestamp to the next page with this %20.

I badly need your help guys.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not just replace the %20 with spaces after you've retrieved the passed parameter on your second JSP page?

Something like:

<%
String dateParam = request.getParameter("dateTime");

String formattedString = dateParam.replaceALL("%20"," ");
%>


At least, that's how I'd fix it myself anyways.


Nick
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by N D Fisher:
Why not just replace the %20 with spaces after you've retrieved the passed parameter on your second JSP page?



Not necessary. The decoding should be automatic.

Is this a real problem, or only one you think is a problem because you see %20 on the URL? When the parameter is retrieved, the URL decoding should be automatic.

If it is a real problem, how are you obtaining the parameter value on the target page?
[ June 20, 2007: Message edited by: Bear Bibeault ]
 
N D Fisher
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:


Not necessary. The decoding should be automatic.



OK, no probs. I was presuming the characters were still there when he retrieved the string........


Nick
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by N D Fisher:
I was presuming the characters were still there when he retrieved the string



Even if that is the case, the correct approach is to find out why the automatic decode isn't working as expected rather than putting work-around code on the page.
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks N D Fisher & Bear Bibeault,

Actually I got the timestamp with %20 from the URL, I have to use this timestamp to retrieve the record from DB. automatic decode is not working, actually I have to compare this timestamp with the timestamps in DB, if i do it as it comes from URL it says no records found. if I do some work around its working... please let me know the proper way of doing...

can you please fix my issue...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Frederik Ericsson:
Actually I got the timestamp with %20 from the URL



I ask again: how?
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
while am using getParameter(timestamp), it rerutns
2007-06-16%2019:16:57.798 while send this param to pull the record from DB.. there the issue goes...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Frederik Ericsson:
while am using getParameter(timestamp)



getParameter() will decode the URL parameters. So the the only way that the %20 can "survive" this decoding process is if it has been doubly-encoded in the first place.

So now the question becomes, how are you creating the URL and what does it look like when you use it?
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://***.***.com:8080/****/***.jsp?appid=****×tamp=2007-06-18%2015:31:32.747
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that looks correct. But when I plug a URL with that same query string into my own test page, the %20 is decoded to a space as expected.

Are you sure that's the exact URL? Can you show us the actual code that's fetching the value?
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
timestamp=document.Display.record[count].value

document.DisplayRecords.action=****/***********.jsp?timestamp="+timestamp;
document.DisplayRecords.submit();
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, while I'm not sure that it's the cause of your problem, putting a query string onto your form action is definitely a poor practice.

Rather, make timestamp a hidden element in your form.
 
reply
    Bookmark Topic Watch Topic
  • New Topic