Solved

jsp from page

Posted on 2004-04-18
11
282 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
  • 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now