How to get URL of the previous visited page in the currentpage? how to find the difference between two Dates?
My Email id:chaluvadiv@usa.net
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
I am not sure what you are asking or the context of you discussion....Could you pl elaborate on this.... what confuses me most is that you say you are a beginner Regds. - satya
clarification Q no1: After submission of a webpage,it should lead the user to the previous visited page. I used HttpServletRequest.getRequestURI(), but after submission its leading to the same page and I want the previous visited page. pl drop the possible ways to handle it. clarification Qno2: I have two java.util.date objects.How to find the difference between those two dates in the form of a String or any format(preferably like "1 year", "2 1/2 years") Please give the block of code to solve that. I expect that you understand my questions. venkat
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
chaluvadiv, Here is a solution dor your question 1. The logic I used is, grab the current URL from HttpUtils.getRequestURL(req) method and put it in the user's session with a tagName like 'Prev_Visit_Url' (which I used in the following code). I assume you use servlets for this. So in the servlet at any time we can check for the CURRENT_URL and PREV_URL. I tested this code with one of my web application for you. It works fine. Instead of HttpUtils.getRequestURL(req) you can also use your method .getRequestURL() also. regds maha anna
[This message has been edited by maha anna (edited September 16, 2000).]
venkateswarlu chaluvadi
Greenhorn
Joined: Sep 14, 2000
Posts: 4
posted
0
Thank you I'll check it out
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
For Q2). Can't you just invoke getTime() on the two date objects and convert the difference(in milli seconds) into appropriate scale? fl
venkateswarlu chaluvadi
Greenhorn
Joined: Sep 14, 2000
Posts: 4
posted
0
I want difference between two date objects in days. I expect professionals to drop a bit of code for the above mentioned problem. Thanx, venkat
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I think you're being lazy - what more do you need? You get the time diffenece in milliseconds - just figure out how many millisecs there are in a day(24*60*60*1000), and divide the diffenece by this number! fn