How do I get the URL of a jsp page which calls a servlet?

I have a jsp page which will lead to a servlet, I can get the URL of the servlet, but how do I get the URL of the jsp page which lead to the Servlet in the servlet?

You could try doing:
request.getHeader("Referer");

Similar Messages

  • How do I get the URL of a jsp page?

    I have a jsp page which has a link to a servlet page, in the servlet page, I want to get the URL of the jsp page.
    I tried to use request.getHeader("referer"), it seems like if it is a link in the jsp directly lead to the servlet, it works, but if the link calls a javascript function which opens up a window runing the servlet, it is not working. I have to do the second way, so it is not working by doing request.getHeader("referer")
    I tried to use javascript "location.href", I get the whole url by alerting the url in the jsp page:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal&bcd=ABC123&pnm=P1001830&prnm=1&psd=236863.0&ln=01&sln=NYPPA&stp=2.1&stt=A&_POSID=1F8464122ADAF4EEC9B1A94C286EB252
    then I pass this url when calling with my servlet, in the servlet page, when I do request.getParameter("url"), the url is actually cut off like this:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal
    anything after &pnm is cut off, anyone has any idea?
    Thanks in advance.

    Thank you.
    but how do I put encoding in the javascript code? do I need to decode in my servlet page?
    here is my code in the jsp page:
    linkset[3]+='<div class="menuitems">Email Diagnostics to AutoOne</div>'<%     
    function emailDiagnostics()
    win = window.open("/pos-webapp/serv/email_diagnostics?url=" + location.href + "&browser=" + navigator.appName, "emailDiagnostics",
    "width=350, height=140, resizable=no, scrollbars=no, toolbar=no, location=yes, directories=no, status=no, menubar=no, copyhistory=no, left=450, top=300");
    win.focus();
    }

  • How can I get the "pageContext" object in jsp page?

    Hi everyone:
    I want to get struts's DataSource object in jsp page.So I should get the PageContext object in jsp page.My code is:
    ///////////////////datatest.jsp///////////////////////////////////
         DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    Is right?But I get the "NullPointerException" error in Tomcat.The connection pool in struts-config.xml is:
    <data-sources>
    <data-source key="mydatasource">
    <set-property property="autoCommit"
    value="false"/>
    <set-property property="description"
    value="MyWebSite Data Source Configuration"/>
    <set-property property="driverClass"
    value="org.gjt.mm.mysql.Driver"/>
    <set-property property="maxCount"
    value="4"/>
    <set-property property="minCount"
    value="2"/>
    <set-property property="password"
    value="qijiashe"/>
    <set-property property="url"
    value="jdbc:mysql://localhost:3306/myweb"/>
    <set-property property="user"
    value="lyo"/>
    </data-source>
    </data-sources>
    I can query the database in servlet.
    I think the method that I get the context is not right.Had someone get the pagecontext in jsp page?help :(

    Sorry I forgot that I had change the code:
    DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    to the code:
    DataSource ds=(DataSource)pageContext.getAttribute("mydatasource");
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    mydatasource is the struts datasource in "struts-config.xml". I couldn't work

  • How do I get the bean property to JSP page for use in a Scriplet

    Hi all,
    I am new to JSF and would like to know how can I get the Bean property to a JSP page and then use that property to dynamically display the contents.
    Thank in advance,

    Hi,
    I think the following page will be helpfull.
    http://java.sun.com/developer/technicalArticles/javaserverpages/JSP20/
    Akif

  • How do I get the URL to "My Photo Stream" (the base one, Not the one I created to share out)?

    How do I get the URL to "My Photo Stream" (the base one, Not the one I created to share out)?

    You can't get a url for my photo stream; only for publically shared streams.

  • How Can i get the URL of a page

    How Can i get the URL of a page . like in ASP the
    Request.QueryString() ...
    Thanks

    Are you wanting actual URL or just the url (query string
    variables)?
    For url variables you would reference the structure.variable
    name like so:
    #url.variablename#
    So if you had a url like this:
    http://www.somedomain.com?page=home&action=view
    You could access the variables like so:
    #url.page#
    #url.action#
    If you are wanting to actual page you could use:
    #cgi.script_name#
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technologies, Inc.
    =============================
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "Yasmin_lady" <[email protected]> wrote in
    message
    news:e4fhjv$fpl$[email protected]..
    > How Can i get the URL of a page . like in ASP the
    Request.QueryString()
    > ...
    > Thanks

  • How do I get the "Restriction" off my phone when I call  so they know it is me calling?

    How do I get the "Restriction" off my phone when I call  so they know it is me calling?

    Here you go.   http://m-support.verizonwireless.com/clc/devices/knowledge_base.html?id=20203   http://support.verizonwireless.com/faqs/Features%20and%20Optional%20Services/faq_caller_id_block.html

  • The pdf file that i am converting has multiple pages but the conversion only exports the 1st page into excel.  How do i get the product to include all pages on multiple sheets?

    Hi,
    The pdf file that I am converting has multiple pages but the conversion only exports the 1st page into excel.  How do i get the product to include all pages on multiple sheets?

    Hi christinek,
    Can you please tell me how the PDF that you're converting was created? Sometimes, PDF files created by third-party PDF generators (that is non-Adobe applications), don't contain all the tags and file information necessary to ensure a proper conversion to Excel. There are no settings that you can change in ExportPDF to adjust how the file is imported.
    You can tell how the PDF was created by choosing File > Properties in Reader and looking for the PDF Producer on the Description tab. If the PDF was created by a third-party, it just may not be written to spec. Please see Support Policy for PDF Files created by non Adobe applications.
    Best,
    Sara

  • How can I stop the execution on a JSP page and start it again

    Hi
    I am making a program that simulates how to manage transactions when accessing a database by using locks. I have run into a problem and I hope someone has the time to help me.
    When a user does an update the transaction commits and releases its locks when the program executes
    <%stmt.executeUpdate("commit!"); %>
    I need to put a break in to stop the program executing this statement, to illustrate the lock is set correctly.
    I have tried to put in an alert box but this does not prevent the rest of the java code being executed.
    I have tried to use prompt boxes, JavaScript functions, but these functions cannot have any java code in them.
    I have tried using the java.swing JOptionPane boxes but this didn?t work either
    I have tried to get input from the user but I don?t know how to retrieve this data on the same page. (As far as I know you have to use submit and even refresh the page or retrieve it on the next page).
    Does anyone know how I can stop the execution on a JSP page and start it again (on same page)
    Mette

    I already have another client (Tomcat jsp application) running and it throws a SQLException correctly when I don�t put in a commit=true statement and don't close the database connection.
    But the problem is how to get the code above to stop to illustrate I have set this lock.
    I have tried to use the JOptionPane but because my program is running in a web browser I cannot use the JOptionPane dialog box.
    I have tired using an alert box but it executes the commit statement before the alert box is dispayed. So this does not work
    While (i < 2)
    if( i==1)
    %>alert(�The transactions commits when you press Ok�); <% //what it to stop execution here
    else
    stmt.executeUpdate(�commit�);
    I am not using threads so I cannot use the sleep function.
    I am using mysql and have already configured it to detect deadlocks and how long to wait for locks.
    Thanks for your help
    Mette

  • I am unable to reply to your e-mail convermation--how can I get the URL to past into my browser?

    Received a confirmation e-mail requestion me to reply to it and I cannot get the URL to paste to my browser--how can I do this???????/

    Hi June,
    Sorry for the trouble you've had.
    I've verified your account on our end and you should be able to access the ExportPDF service now.
    Please let us know if you have any questions!
    -David

  • How can we get a url for a "Meet Now" conference call from within the Windows Store App?

    Hi,
    Is it possible to get the url for the current meeting / new "Meet Now" call from within the Windows Store app?
    You have the option of inviting your current Lync contacts, but I don't see a way of giving a URL to clients that would launch Lync on their device, or take them to the web app.
    I can see how to get the link using the Outlook plugin, for pre-scheduled meetings. Is this link always the same and the one that should be used for an impromptu "Meet Now" meeting? It would still be good to know how to get this URL from within
    the store app so I can tell clients where to get it.
    Some people may be on Windows RT devices and not have access to the plugin in Outlook, and want to start a meeting at short notice and then invite others via email or pasting a link to them elsewhere.
    Any help appreciated.
    If I have answered your question, please mark it as the correct answer. If I have provided helpful information, please mark it as so.

    Hi,
    Agree with Holger, I check on my Lync Windows Store app and can't find the meeting URL as well.
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • How do I get the URL address of a newly uploaded page?

    I'm using the files manager to upload my page to the server
    at school.
    When I'm viewing the page in Dreamweaver and go to Preview In
    Browser it keeps giving me my local folders address, instead of the
    file I uploaded to the server at school. I need to Preview In
    Browser
    the file on the server so I can copy the correct URL and
    send it to my teacher in an email (I need to send him my link to
    view my work).
    What am I doing wrong?
    I can upload to the server because I see my newly uploaded
    files sitting there in the Files manager.
    How do you Preview In Browser the file on the server? I need
    it's URL address.

    Hi guy
    Preview occurs on your local computer...
    Once it'a uploaded to the server, it's too late for
    "Preview".
    Visit the school's website, or contact the school's server
    administrator
    for the URL path to your pages.
    "smittyboy63" <[email protected]> wrote in
    message
    news:er8cdv$hl3$[email protected]..
    > I'm using the files manager to upload my page to the
    server at school.
    > When I'm viewing the page in Dreamweaver and go to
    Preview In Browser it
    > keeps
    > giving me my local folders address, instead of the file
    I uploaded to the
    > server at school. I need to Preview In Browser
    the file on the
    > server so
    > I can copy the correct URL and send it to my teacher in
    an email (I need
    > to
    > send him my link to view my work).
    > What am I doing wrong?
    > I can upload to the server because I see my newly
    uploaded files sitting
    > there
    > in the Files manager.
    > How do you Preview In Browser the file on the server? I
    need it's URL
    > address.
    >

  • How can I get the gps coordinates on my ipad which was stolen today?

    My ipad was stolen today, how can I get the gps coordinates to report to the sherriff?

    If Find My iPhone (iPad) was turned on on your iPad and the iPad is on and connected to the Internet you will be able to locate it. Go to iCloud.com and sign in with your Apple ID and password. If the device is off or not connected to the Internet you can send a signal to lock or erase the iPad but that action will not complete until the iPad is connected to the Internet.
    If you did not have find my iPhone turned on there is no way to track your iPad.

  • How to get the Url(address) of Next Page in Sequence of Pages in OAF

    Dear All,
    My requirement is to get the next page Url dynamically .
    i have created 2 pages ,first page have button to navigate to the next page ,when i click on first page button ,
    i want to store the url of the next page in column of the database table.
    This is urgent requirement .
    Please suggest .
    Thanks
    Maheswara Raju

    > Is there any way to get the memory address of a
    variable (like int ,float and all) in java.
    No. Chances are excellent that there's a way to do what you want without needing the variable's address, however.
    ~

  • How can I get the URL address of a secure https site to turn yellow

    The older versions of Firefox would turn the URL of a secure website yellow when accessed. Even with poor eyesight, I found this easy to see. When I upgraded to version 3.6, this feature was gone. Some of you programming capable users were kind enough to provide me with a chrome.css routine that made 3.6 act the way I needed it to. Unfortunately, I've been forced to upgrade Firefox to version 16 and the chrome.css file that worked on 3.6 seems to have no effect on 16. Would someone please provide me with a way of getting Firefox 16 to turn the https addresses yellow.

    That was a feature last used in Firefox 2.0 in 2006, a real long time ago ''(in software time.)'' This - http://www.dria.org/wordpress/archives/2008/05/06/635/ - explains the changes which came in Firefox 3.0.
    The code used for the Address Bar was completely changed for Firefox 4.0, which is why the css you were using in Firefox 3.6 doesn't work any longer.
    You could try looking for a "retro 2.0 style" Address Bar for that code, but I spent 15 minutes searching for a newer code and didn't find anything for 14.0 plus versions. ''Note that my search skills aren't the best.'' <br />
    http://userstyles.org/
    This is the closest I could find, but it isn't even close to what was used in Firefox 2.0. <br />
    http://userstyles.org/styles/69835/identity-box-earth-simple-fx-14 <br />

Maybe you are looking for

  • Sync Photos from PC = double Photos??

    When I "Sync Photos from" my PC in Itunes, I choose a folder I call Iphone Photos, where I place the pcitures I want on my phone. When the sync is complete, I get TWO folders, with the same pictures in both, my iphone photos, and Photo library. Why??

  • Format x axis into days of the week

    Hi, i hope someone can help me with this! I wish to change the x axis to days e.g. Monday Tuesday.. however I do not know how to go about doing it. After every 10th point in the array, i wish to put "Monday" on the x-axis and after next 10 points"Tue

  • Texts copying rules

    Hy guys, my problem is this:I insert a text into the view 'Purchase Order Text' in material master record and this text is taken automatically into the tab 'Purchase order text' in the Inforecord : I don't want this,how can I avoid this? Thanks in ad

  • NoMachine(freenx) Authentication failed for user (MYUSERNAME)

    Hi all, I have quite a few experience with freenx on other linux distributions, but this is my first time setting up freenx on archlinux. After following the instructions in the wiki, authentication keeps failing no matter what I do. Stuff I've done

  • Combining multiple files in single 3D model

    We're struggling incorporating multiple .stl models to form a single file with an expandable model tree. Adobe v8.2.4, WinXP. We can get individual files on separate pages, but not embedded in the same page, such that you can select/hide individual o