Re: request.getRequestURL()
- From: ge0rge <ge0rge@xxxxxxxxxxx>
- Date: Thu, 28 Dec 2006 20:31:33 +0000
maya wrote:
is this method, request.getRequestURL(), right method for doing same thing w/JavaScript you do with window.location()?? I think it is, but just double-checking..
this is for a JSP, I need it to print diff code depending on what current url is.. this is what I did:
String thisURL = "";
thisURL = request.getRequestURL().toString();
........
if (thisURL.indexOf("events/index.jsp") != -1) {
%>
print this code.. (this code being custom tags, hence the %>...<%..)
<%
} else if (thisURL.indexOf("events/index.jsp") == -1) {
%>
print this code..
<%
sound good? it works, but I want to make sure this is 100% kosher, it's for something at work..
thank you very much..
hmm... surely if you wrote the above, you should know what it's supposed to do. You are just testing whether the URL from which the request originated contains the string "events/index.jsp" (the second if is redundant in this particular bit of code). If it works, which bit are you not 100% sure?
.
- References:
- request.getRequestURL()
- From: maya
- request.getRequestURL()
- Prev by Date: Re: a way of converting a roman numeral into an integer
- Next by Date: Re: jsp prg
- Previous by thread: request.getRequestURL()
- Next by thread: Need Development Environment Advice
- Index(es):
Relevant Pages
|
|