Solved

jsp from page

Posted on 2004-04-18
11
286 Views
Last Modified: 2010-04-01
Hi Experts,

How can I get URL of some page where my main JSP page was opened from ?

Thank you.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10855978
<%
String uri = request.getRequestURI();
String querystring = request.getQueryString();
%>
0
 
LVL 92

Expert Comment

by:objects
ID: 10855985
also:

StringBuffer url = request.getRequestURL();
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10856059
I was trying it before I posted this question. For some reason I get main jsp url not the one where it was initiated from.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 10856079
Sorry misunderstood what u wanted.
If you want the URL of the page that called the jsp, check the referer request header.

request.getHeader("referer");
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10856181
You mean Just in main.jsp :

String ref = request.getHeader("referer");

0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10856188
Can it be a problem if I open main.jsp using javascript from html ?
0
 
LVL 92

Expert Comment

by:objects
ID: 10856234
the referer header is not guarnteed to be there, i think it is dependant on the browser as to whether it is included or not.

You could pass the url as a query parameter when you call main.jsp.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10856269
I am trying to accomplish the following thing:

1 It is login page
2 I cannot use cookies or session becuase of client's requirements
3 I get user, password if valid then open main.jsp using javascript
4 in main.jsp I would check if page where it was opened from login.html
5 if it is then continue if not go to login.jsp  

The problem is that I want to check it only first time. I would keep it in  my url but don't want to check it every time page processed
and besides that the url is changing constantly due to application requests.

Is it doable without session variables and cookies ?

Thank you.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10856288
> Is it doable without session variables and cookies ?

Not that I can think of.

Are you using a database? If so you could store some unique key for the user when they logged in and pass that id as a parameter to every page and use that to lookup database to determine if user logged in ok. bit messy though.
0
 
LVL 92

Expert Comment

by:objects
ID: 10856564
How come the client doesn't want to use sessions?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10862382
:) Sometimes they do.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question