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();
}

Similar Messages

  • 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");

  • 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

  • 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 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 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 />

  • How can I get the URL in my history to send me to the right webpage instead of the webpage I was viewing before i opened my history?

    It seems to send me to the right link occasionally, but this is a rare occasion. Ive went to my settings and browser preferences and there is not an option found that would prove to solve the problem.

    Let me repeat your question to ensure that I understand correct. You open history and click on a URL but the browser simply returns to the same page rather than opening the URL that you selected in the current tab. Is that correct?

  • How do I get the url of the aspx into Flash

    Hi,
    I am about to embed a swf-file into my .aspx-file.
    My need is as follows.
    In the swf I want to be able to check wich url the embedded swf is loaded in. (url.se/url.no/url.dk... etc) that is the url for the .aspx
    If I'm on the .se-url : the dynamicfield_A should load variable TextLanguageSE
    If I'm on the .dk-url : the dynamicfield_A should load variable TextLanguageDK
    etc.
    I hope for an easy solution for this or I'll have to make 4 diffrent swfs...
    /K

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

  • How do i get the url line back so I can surf the web?

    I don't have a line to write in the website I want to surt to? any help ?

    You probably went into Full Screen mode by pressing "F11", you can toggle back out of it by pressing "F11" again. It is a very useful keyboard shortcut.
    See
    * http://dmcritchie.mvps.org/firefox/keyboard.htm
    * https://support.mozilla.org/kb/Keyboard+shortcuts
    Or you may have hidden the Navigation bar
    * "Alt+V" -> Toolbars -> Navigation bar
    Or if showing the Navigation bar you may need to customize the Navigation bar to restore the Location bar portion.
    * "Alt+V" -> Toolbars -> Customize
    More information:
    * Toolbar customization - MozillaZine Knowledge Base<br>http://kb.mozillazine.org/Toolbar_customization_-_Firefox
    * How do I customize the toolbars? | How to | Firefox Help<br>https://support.mozilla.org/kb/how-do-i-customize-toolbars
    * Is there any way to save a customized toolbar layout? | Firefox Support Forum | Firefox Help<br>https://support.mozilla.org/questions/897033
    You can make '''Firefox 9.0.1''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 9.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
    <p>There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.</p>
    <p><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small></p>

Maybe you are looking for

  • Can I recover FileVault data when the sparsebundle was deleted on a MacBook Pro running OSX 10.6.8?

    I have a MacBook Pro that I purchased from a friend of mine. He reformatted it before giving it over to me, and he left me a couple of install files in the Downloads folder before he gave it to me. When I got it, I turned on FileVault because encrypt

  • Validation on Execution of workitem

    Hi all,        I have  a scenario in which  a workitem with expense value 7000$ has  gone  for approval to manager1 in his UWL. Manager1 can approve expense upto 10000$ But when this  workitem  was  created Manager1 has  gone  on leave and  he has  s

  • How to create Contract in SAP backend systems( R/3)

    Hello All, We have SRM4.0 with classic scenario. We don't have sourcing cockpit , bidding engine and all activated. Please suggest me, how can I create contract in backend system? We don't want to create GOA in SRM system and distribute it to backend

  • Updating a database from a JTable

    So, in my GUI class, the user searches for the records of an event and round, which returns 9 records into my JTable for me. This is how i do thi else { List<UpdateEventSetGet> searchResult = sql.searchRecords(sType, sType2); for(int x = 0, y = searc

  • Camera profiles for native D80 modes

    Hi to all, I would like to know if there are the camera profiles (self-maded with DNG profile editor o similar) which simulate the native color mode of D80 (mode Ia, II and IIIa) because LR and ACR support only new color profiles from EXPEED chip (NA