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..
ge0rge - 28 Dec 2006 20:31 GMT
> is this method, request.getRequestURL(), right method for doing same
> thing w/JavaScript you do with window.location()?? I think it is, but
[quoted text clipped - 22 lines]
>
> 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?