Solved

jsp from page

Posted on 2004-04-18
11
285 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting NoSuchMethodError on accessing a spring mvc project 3 173
JSONSerializer.toJSON in JSP generating error 8 90
thymeleaf natural templating vs JSP 2 165
servlet example 17 59
Read the original post on Monitis Blog. Believe it or not, the most important thing about the website of your business is not what’s on it but how fast it loads. Yes, that’s right!    As you can see on this infographic (an oldie but goodie!), …
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

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