I want to use the method getRemotePort() in a jsp page.....................

I have tried using it like this:
<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%@ page import = "javax.servlet.*"%>
<%
out.println("<br>Remote Port : " +
request.getRemotePort());
%>
I get the following error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 4 in the jsp file: /test/cookie.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\work\Standalone\localhost\_\test\cookie_jsp.java:51: cannot resolve symbol
symbol : method getRemotePort ()
location: interface javax.servlet.http.HttpServletRequest
request.getRemotePort());
^
1 error
I think i need to import some page but am not sure which one. Can someone help on this please?

well im using tomcat 4.1. Is there another way of getting the same information on the latest servlets? I mean instead of using getRemotePort() are there any other methods used in the latest servletes to get the same information?

Similar Messages

  • I want to use the custom request header in JSP How can I use that

    Hi Guys,
    I have following scenerio...
    1: There is one third party tool which is calling my.jsp page from the specified directory.
    2: Before calling the JSP that third party tool is adding some data like <user name> and <password > in the header of that JSP.
    Problem: I am not getting thos custom added header in side the JSP.
    Header information is given below:
    http://localhost:8100/wvsat/brand/ncr/auto.jsp
    GET /<APPLICATION_NAME>/ <JSP_PAGE_NAME>.jsp HTTP/1.1
    Host: localhost:8100
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Cookie: AreCookiesEnabled=195; JSESSIONID=2a30e33e48384dd13222
    MyUsername: demo*
    MyPassword : demo*
    HTTP/1.x 200 OK
    Date: Wed, 24 Sep 2008 19:42:22 GMT
    Content-Type: text/html; charset=UTF-8;application/x-www-form-urlencoded
    Connection: close
    Server: JRun Web Server
    Now within the JSp page i want the value of MyUserName and MyPassword
    For gettting these value i am using the request.getHeader(MyUserName);But it is returning null.
    Note:+*
    1: I want to forward this value to another servlet which is based on Struts framework_.
    2: For adding the value in the header i am using Http Live header Addons of FireFox_
    Could anyone help me in the same!!!
    Thanks in Advance

    Sorry, perhaps I was not explicit enough.
    Your code snippet: request.getHeader(MyUserName);
    It was missing quotes to make it a String value.
    If that is what you have, then it is using the VARIABLE MyUserName, and not the actual value "MyUserName"

  • Using the Parameter twice in a jsp page

    I need to use a parameter twice I am really new to this and I know very little
    about java I need to use it where I put HERE can anyone help me!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.sql.*"%>
    <%@page import="java.util.*"%>
    <jsp:useBean id="dbset"  class="Beans.dbset" />
    <html>
    <body>
    <%String  res = request.getParameter("image_id");
    String sql = "SELECT DISTINCT episode_id, episode_date, link FROM episode_char_Query where character_id = " + res ;
    dbset.setQuery(sql);%>
    <table>
    <%
    Vector outvec = new Vector();
       Vector invec = new Vector();
    outvec = dbset.getResults();
    invec = (Vector)outvec.elementAt(1);
    for(int i=0; i<outvec.size(); i++)
    %>
      <tr>
    <%
    for(int j=0; j<invec.size(); j++)
        if(i!=0 && j==0)
    %>     <td align="center">
           <a href="episode.jsp?episode_id=<%=((Vector)outvec.elementAt(i)).elementAt(0).toString() %>&character_id ="HERE/>Click here to show scenes</a>
           </td>
    <%    }
        if(i!=0 && j==2)
    %>     <td align="center">
           <a href='C:\eastenders\<%=((Vector)outvec.elementAt(i)).elementAt(2).toString() %>'/>Click here to play episode</a>
           </td>
    <%    }
        else
    %>       <td align="center"> 
             <%= ((Vector)outvec.elementAt(i)).elementAt(j).toString() %>
             </td>
    <%      }
    %>
      </tr>
    <%
    %>
    </table>
    </body>
    </html>

    um.
    yuck.
    I would suggest you use some JSTL.
    Mixing html and scriptlet code like this is a recipe for disaster:
    And whats with all this if j==1, j==2 crap?
    Seeing as you only have three items being returned, it would be much simpler just to have one loop, and access vector elements 0,1,2 directly rather than having a double loop.
    At LEAST pull some of the stuff into temporary variables.
    <c:forEach var="episode" items="${outvec}" varStatus="status">
      <c:choose>
        // first line is headings?
         <c:when  test="${status.first}">
            <td align="center">${episode[0]}</td>
            <td align="center">${episode[1]}</td>
            <td align="center">${episode[2]}</td>      
         </c:when>
            // all other lines print the data
         <c:otherwise>
      <tr>
        <td align="center">
           <a href="episode.jsp?episode_id=${episode[0]}&character_id=${param.image_id}">Show scene</a>
        </td>
        <td align="center">${episode[1]}</td>
        <td align="center"> <a href='C:\eastenders\${episode[2]}'> play episode </a></td>
      </tr>
      </c:otherwise>
    </c:forEach>You see how much clearer it is without the nested looping and complicated if syntax?
    Do yourself a favour - take a step back get JSTL and rewrite it from scratch.
    You will be thanking yourself later.
    Cheers,
    evnafets

  • UIX/JSP - How to use the UIX Controller with UIX/JSP

    After reading the UIX Developers Guide I am under the impression that I could use the UIX Controller with UIX/JSP pages. Is this correct and are there any available examples?
    Bill G...

    It's correct, but I'm afraid we don't have much (read as "any")
    documentation on how to do that - besides reading through the
    gobs of Javadoc and guessing how to put it together.
    Half of the problem is solved by registering JspPageDescriptions
    on a PageBroker (e.g., UIXPageBroker) to tell the UIX Controller
    to use a JSP to render a particular page, instead of a UIX XML
    document.
    The other half is getting the JSP to send requests back to
    the UIX Controller. Depending on how you've chosen to name
    your pages, create either a DefaultPageEncoder or ExtensionPageEncoder
    inside your JSP, and use that to create destination URLs.

  • HT1338 Dear all, I have just bought a MacBook pro with osx lion on 25thast month. I wanted to know if I can use the methods described above to update to osx mountain lion or I have to buy osx mountain lion from the app store?

    Dear all, I have just bought a MacBook pro with osx lion on 25th last month. I wanted to know if I can use the methods described above to update to osx mountain lion or I have to buy osx mountain lion from the app store?

    Here are the rules to qualify for the free upgrade:
    http://www.apple.com/osx/uptodate/
    (has to be purchased from Apple or authorized reseller).

  • I have gotten a giftcard for iTunes and I want to spend it but before I had a credit card giftcard and I spent it all and now I don't have a credit card and I just want to use thee iTunes one how do I delete the card on my iPhone

    I have gotten a giftcard for iTunes and I want to spend it but before I had a credit card giftcard and I spent it all and now I don't have a credit card and I just want to use thee iTunes one how do I delete the card on my iPhone

    Hello Clancbelle,
    It sounds like you have a credit card saved to your Apple ID payment information and you would like it to be removed from the account and set the payment method to None. You should be able to do this with the following article:
    iTunes Store: Changing your payment information
    http://support.apple.com/kb/ht1918
    Changing your payment information using an iOS device
    Tap Settings on the Home screen.
    Tap iTunes & App Stores.
    Tap your Apple ID. (If you aren't signed in, enter your Apple ID and password and tap Sign In.)
    Tap View Apple ID.
    Enter your Apple ID password.
    In the Edit section, tap Payment Information.
    Update the information that you want to change.
    Tap the Done button when you're finished.
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • I have a new computer and I want to use the "MasterPassword" again. How do I import all of the saved website passwords/logins from my old FireFox computer?

    I have a new computer and I want to use the "MasterPassword" again. How do I import all of the saved website passwords/logins from my old FireFox computer?

    A couple of methods.
    The first is to copy 2 files, key3,db and signons.sqlite from the profile folder of the old computer t the profile folder of the new computer. For details of how to find the profile folder see the [[profiles]] article.
    The second method is to install the [https://addons.mozilla.org/en-US/firefox/addon/2848/ Password Exporter] add-on on both computers and use that to export/import the passwords.

  • How do I change the icloud account on my iphone? I want to use the same account for all my apple devices (macbook air and imac and iphone). I can't see where I can amend the iphone account because it is in grey?

    I want to use the same account for all my apple devices (macbook air, imac and iphone). I can't see how I can amend the iphone account because it is in grey? I also can't remember the password for this account so i can't even delete it and start again?
    Help!
    Thanks

    Deleting an iCloud account only deletes it from the Device, not from iCloud.  In iOS 8, the name of this setting changed to "Sign Out" as that is a better reflection of what actually happens.  Your iCloud data remains on the server, available to devices still signed into the account, but the device you sign out of the account on is disconnected from the account, and as a result, the iCloud data from that account is removed from the device.  It will redownload to the device should you sign back into the account.
    The only issue you'll run into when you switch between accounts is with my photo stream photos older than 30 days.  When you delete (or sign out of) and account, your photo stream photos are deleted along with the other data from the account in question.  However, unlike other data which remains on the server and can redownload to your device when you sign back in, my photo stream photos only remain in iCloud for 30 days.  When you sign back in, you will only get back my photo stream photos added in the last 30 days (as older photos are no longer in iCloud to redownload).  Like other account data, any my photo stream photos on your other devices signed into the account are unaffected by this.  If you want to keep older my photo stream photos on your device as you change iCloud accounts, save them to your camera roll before deleting (signing out of) the account.

  • Ive lost my apple ID for my ipod, now i have an iphone and i want to use the same apple ID for both can someone tell me how to do this

    I have lost my apple ID for my ipod, now ive got a new iphone and i want to use the same ID for both, can anyone one tell me how to do this? ( i no my ID for the iphone)

    Just use the same ID.
    These may alos help:
    How to use multiple iPods, iPads, or iPhones with one computer
    What is the best way to manage multiple...: Apple Support Communities

  • I want to use the Web module to publish to the a website... What kind of server do I need to be able to publish my website?

    I want to use the Web module to publish to the a website... What kind of server do I need to be able to publish my website?

    You don't need a server, you just need a web hosting package such as the ones from GoDaddy or many other hosts. You then send the web gallery directly from LR to your web space.
    As you're asking such basic questions, it might be best if you read articles like this and see if a friend or colleague can get you started.

  • I scanned an image and want to use the image trace tool, but it doesn't pick up all the lines.  Is there a way to darken the lines before using the image trace tool?

    I scanned an image and want to use the image trace tool, but it doesn't pick up all the lines.  Is there a way to darken the lines before using the image trace tool?  Help!

    If the scan is in B&W, then play with the Threshold setting here
    If it's in Color, then you will have to open the scan in a Raster editing software (like Photoshop) and play with the Brightness/Contrast settings to make the lines bolder.

  • Safari wants to use the "login" keychain. -- Why can't Safari remember???

    When I launch the Safari application, I get a dialogue box with a message indicating the following:
    Safari wants to use the "login" keychain.
    Please enter the keychain password.
    Password:
    Cancel -- OK
    When I get this dialogue box, I enter the login keychain password in the Password text box, and I click the OK button. Then, Safari proceeds as normal. This is extremely annoying, because it happens almost every time that I launch Safari.
    This only started to happen after I upgraded on Monday to Mac OS X Leopard version 10.5. During the Leopard upgrade, I had problems with the keychain passwords, and so I then upgraded again with the new "Login and Keychain Update 1.0". But, the problems with Safari forgetting the login keychain password continue.
    The strange thing is that there is NO option in the dialogue box to indicate that Safari should REMEMBER the password. The option does NOT exist, so I can NOT click the Remember box.
    I also went into the Keychain Access utility and double-checked and confirmed that my First Aid preferences were properly CHECKED for "Synchronize login keychain password with account" and also "Keep login keychain unlocked". Both of these preferences options are checked. So, I can't understand why Safari cannot remember the login keychain password?
    I have this exact same problem with the Mail application, as well.
    And, it looks like many many people are having the same problem -- See the following link to related discussions:
    http://discussions.apple.com/thread.jspa?messageID=5679135&#5679135
    Can anyone please help? -- When is Apple going to release a fix for this problem? -- Has anyone received any kind of acknowledgement from Apple that they are aware of this problem and that they intend to fix it?
    Please help !!!

    I had the same experience and found a solution.
    After the upgrade, I had a login keychain (the default) and my original username keychain. Both are in the chain of keychains, but since it has a choice, Mail keeps asking you to confirm.
    I moved all the entries out of username into login, deleted username, and all is well.
    Note that Keychain asks for your password on EACH ITEM that it moves, which can be tedious. So I changed the keychain password to a single character, just for the duration, then changed it back to something secure.
    If, on the other hand, you don't have two keychains, then I can offer no suggestion.

  • I am trying to create a simple animated gif in Photoshop. I've set up my frames and want to use the tween to make the transitions less jerky. When I tween between frame 1 and frame 2 the object in frame two goes out of position, appearing in a different p

    I am trying to create a simple animated gif in Photoshop. I've set up my frames and want to use the tween to make the transitions less jerky. When I tween between frame 1 and frame 2 the object in frame two goes out of position, appearing in a different place than where it is on frame 2. Confused!

    Hi Melissa - thanks for your interest. Here's the first frame, the second frame and the tween frame. I don't understand why the tween is changing the position of the object in frame 2, was expecting it to just fade from one frame to the next.

  • I want to use the Function Generator VI to send command signals through the NI 7344 motion controller. This will be a closed loop servo valve system. I want to be able to change from say a square wave to a sine wave on the fly. Idea's?

    I am going to run tests that require an actuator to move using various types of arbitrary waveforms such as sine or square. The NI 7344 is hooked to the UMI that is going through a driver for a servo valve. The loop is analog and it is closed. I have played with some of the examples but can't get it to work. I have used the function generator VI to generate a signal but I think I am using the wrong input VI to the motion control board. When I use what I have it moves the servo and then stops. It doesn't continually generate the signal.
    I would love to use the controls on the function generator vi to control frequency and amplitude ect. Any help or pointer would be helpful. Thank you in advance.

    Hello,
    I'm not clear on exactly how you want to use the generated data but I'm assuming they will be used as your target points.
    There's a built-in example for motion called 'One-Axis Contour Move.vi'. This example demonstrates how to provide your target points as 1-D array. All you need to do is to replace the input array with the output of the function generator. In order to have it run continuously, use a while loop. You can further program your application so that it'll change the waveform on the fly by monitoring the user interface but this might be little little tricky as you will need to reset the move and load the new generated points while keeping track of your current position.
    I hope this helps. Let me know if you have further questions regarding this
    application.
    Best regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • HT204053 I want to use the same apple id for iTunes and iCloud...but I have both set up..my problem is I want to use the one that I use for iTunes for both

    I want to use the same apple id for iTunes and iCloud...but I have both set up..my problem is I want to use the one that I use for iTunes for both

    iForgot.com

Maybe you are looking for

  • How can I get a single jar file with NetBeans?

    How can I get a single jar file with NetBeans? When I create the project I get these files: dist/lib/libreria1.jar dist/lib/libreria2.jar dist/software.jar The libraries that have been imported to create the project are in separate folders: libreria1

  • How do I transfer my photos and music from windows format iPod to my new iMac

    I have just purchased a new imac and want to transfer my photo's and music from my windows formatted ipod to the imac, can you help? is there a download that can do this transfer?

  • MacBookPro loses automatic AirPort Connection

    My MacBook Pro used to connect automatically to my Airport Express network everytime I opened up or turned on the computer. Recently I accidentally unplugged my Airport Express. Since then, my laptop no longer connects automatically. (In other words,

  • Web performance test using Ultimate VS2012 is possible?

    Hello,  I worked on automation using VS2012 for different client who used .net. Now i am on different account who used Java and my goal is same to convert day to day functionality checked in automation. Any help?? how to start where to start??? Thank

  • Listen for Full Screen mode

    I have a FLVPlayer with a skin on stage and I want to listen for the player going into full screen mode when the skin's fullscreen button is clicked. And I want to listen for it going back to normal but I think that is easy enough, I just listen for