Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / December 2006

Tip: Looking for answers? Try searching our database.

request.getRequestURL()

Thread view: 
maya - 28 Dec 2006 18:44 GMT
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?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.