Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jsp from page

Posted on 2004-04-18
11
Medium Priority
?
289 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

618 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