Need help in url encode

hai everybody,
my url looks like this
http://localhost:8080/examples/title=Project manager&company=XYZ pvt ltd.
whats happening is that , since i have space in my url .. all the values after the first space is been truncated..how do i encode the url.could anyone help me out.
thanx in advance
regards
koel

import java.net.URLEncoder
<% String qryStr = "company="+URLEncoder.encode("XYZ pvt ltd");%>
<a href="/examples/<%= qryStr %>">click here</a>
then you can use request.getPathInfo() to get the result.
hope it helps.

Similar Messages

  • URGENT: Need help reading URL of current page

    Hello kind people!
    I need help, and its very simple:
    How do i read the URL of a web page?
    For example, the URL of this page is:
    http://forums.sun.com/thread.jspa?threadID=5327796
    So how can i be able to read in this URL in my java program?
    thanks SO MUCH
    P.S. I HAVE searched the java docs and everything, the closest thing i found was request.getRequestURL().? but i have no idea how to use it. you have NO IDEA how appreciative i would be if you could simply show me exactly how to read in the URL of a given page.
    thanks SO MUCH
    Edited by: homegrownpeas on Aug 31, 2008 5:19 PM

    Going by what I understand here is a simple version of how you can read data from over HTTP.
    This expects the "page" to be text (hence an InputStreamReader instead of an InputStream.)
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.HashMap;
    * GPLv2.
    * @author karlm816
    public class HomeGrownPeas {
          * @param args
         public static void main(String[] args) {
              HashMap<String, String> params = new HashMap<String, String>();
              params.put("threadID", "5327796");
              System.out.println(loadHttpPage("http://forums.sun.com/thread.jspa", params));     
         public static String loadHttpPage(String sUrl, HashMap<String, String> params) {
              // Build the HTTP request string
              StringBuilder sb = new StringBuilder();
              if (params != null) {
                   for (String key : params.keySet()) {
                        if (sb.length() > 0) {
                             sb.append("&");
                        sb.append(key);
                        sb.append("=");
                        sb.append(params.get(key));
              System.out.println("params: " + sb.toString());
              try {
                   URL url = new URL(sUrl);
                   URLConnection connection = url.openConnection();
                   connection.setDoOutput(true);
                   connection.setRequestProperty("Content-Length", "" + sb.length());
                   connection.setUseCaches(false);
                   if (connection instanceof HttpURLConnection) {
                        HttpURLConnection conn = (HttpURLConnection) connection;
                        conn.setRequestMethod("POST");
                   OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
                   osw.write(sb.toString());
                   osw.close();
                   // Now use sb to hold the resutls from the request
                   sb = new StringBuilder();
                   BufferedReader in = new BufferedReader(
                         new InputStreamReader(
                         connection.getInputStream()));
                   String s;
                   while ((s = in.readLine()) != null) {
                        sb.append(s);
                        // To make it more "human readable"
                        sb.append("\n");
                   in.close();
             } catch (IOException e) {
                  e.printStackTrace();
                  return null;
            return sb.toString();
    }

  • ComboBox (dropdown) Need Help Adding URL links!!!

    I am somewhat of a newbie....Anybody know how to use URL
    links in a ComboBox dropdown menu? NEED HELP!!!!!!! I'm trying to
    make it so that after selecting an option, the user is directed to
    another URL within the same browser window. Using flash 8!
    Thanks,

    Im a bit a newbie myslef but i think you make flash
    commuincate to javascript wich will make the browser goto the URL.
    do a search on getURL and javascript together and i am sure
    you will find something.
    And when slecting to redirct i think its on?(onPress)
    something so maybe look throught the help section in flash 8 and
    look at componets. I think there is some actionscript help there.
    Sorry i could not be more helpful.

  • Need help creating URL for getImage

    In the following code example, I get an error when javac compiling. I need help, because I cannot determine what is wrong. "....." denotes extraneous code removed for readability.
    import java.awt.*;
    import java.io.*;
    import java.applet.*;
    import java.net.*;
    public class testapp extends java.applet.Applet implements java.lang.Runnable
    public static void main(String[] argv)
    ����.
    public void init()
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image image1 = toolkit.getImage("imageFile.gif");
    Image image2 = toolkit.getImage( new URL("http://java.sun.com/graphics/people.gif"));
    ��
    javac reports:
    unreported exception java.net.MalformedURLException; must be caught or declared to be thrown
    Image image2 = toolkit.getImage( new URL ("http://java.sun.com/graphics/people.gif"));
    ................................................^

    With this recommended code:
    ===================
    try {  Image image2 = toolkit.getImage( new URL  ("http://java.sun.com/graphics/people.gif"));}catch(MalformURLExceptione){System.out.println("Error"); }
    ======================
    it now compiles ok, but when I access the page through the browser, I get "applet not initialized" and the page times out.
    With the lines commented out, the page loads.
    What does this tell us:
    - all we have done is mask a problem that the compiler previously highlighted.
    But what is the problem?
    As far as I can tell, the code is exact copies from the examples posted online.
    Where should System.out.println("Error"); be displayed? I can't find it. There might be a clue in the error message.

  • Hi I need help on URL Connection Class

    Hi
    I have read the documentation but cant get it . I have to Use the getContent(); method so can any one make a program for me in which all of the methods of this class have been used?
    I Also Need help on Content Handler Class Please give me one example on it but separate from the above one
    Thanx alot

    Hi
    Man Some Times We need help and as of google, Google is My Best Friend. and as of forums search i know that but some time we have less time and much to work. The Time Doesnt wait us. we have to save our time. thanx for ur help and ur comments i like it.

  • Help Needed With Simple URL Encoding

    I am making a simple webserver. I have seen that the spaces are converted to %20 as the url is encoded. But what I would like to do is to also allow the hosting of files that contain %20 in their names i.e. I would like to differentiate between two cases when the user entered a space and it is converted into %20 and when the user explicity wrote %20 in the url. I tried to do it via the URLDecoder class but it converts %20 into a space in both cases. Any help will be greatly appreciated.

    omariqbalnaru wrote:
    . I would like to differentiate between two cases when the user entered a space and it is converted into %20 and when the user explicity wrote %20 in the url.You cannot. There is no difference at your end between those two cases.

  • Need help with URL Redirect in Sun Web Server 7 u5

    All I am trying to do is redirect to a static URL and for the life of me I can not get it to behave the way I would expect. I am new to Sun Web Server so I am just trying to use the Admin Console to set this up.
    Here is what I'm trying to do:
    Redirect from - http://www.oldsite.com/store/store.html?store_id=2154
    To - http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Here's what I tried in the console.
    Added a new URL Redirect
    Set the Source to be Condition and set it to: '^/store_id=2154$' (quotes included)
    Then set the Target to: http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Then for the URL Type I checked Fixed URL
    When I tested with: http://www.oldsite.com/store/store.html?store_id=2154 it did redirect as desired
    BUT
    When I tested with: "http://www.oldsite.com/store/store.html?store_id=5555" it too got redirected to the Target and I can't figure out how this second URL can satisfy the condition to get redirected.
    Any help is most appreciated.

    thanks for choosing sun web server 7
    it is simpler if you just edit the configuration files manually
    cd <ws7-install-root>/https-<hostname>/config/
    edit obj.conf or <hostname>-obj.conf (if there is one for you depending on your configuration so that it look something like)
    <Object name="default">
    AuthTrans..
    #add the folllowing line here
    <If defined $query>
    <If $urlhost =~ "/oldsite.com" and
    $uri =~ "/store/store.html" and
    $query =~ "store_id=2154" >
    NameTrans fn="redirect" from="/" http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    </If>
    </If>
    ..rest of the existing obj.conf. continues
    NameTrans...
    now, you can either do <ws7-install-root>/https-<hostname>/bin/reconfig -> to reload your configuration without any server downtime or <ws7-install-root>/https-<hostname>/bin/restart -> to restart the server
    if it did work out for your, you will need to run the following so that admin server is aware of what you just did
    <ws7-install-root>/bin/wadm pull-config user=admin config=<hostname> <hostname.domainname>
    hope this helps

  • Noob needs help with Media Encoder Settings

    Hi All,
    Please be gentle with me. I am very new to this.
    I am using PPCS4 full version on which I am trying to edit and export video from my Canon HF 10 using their AVCHD format.
    The Mac is a MAC PRO 2 x QuadCore 3.0Ghz, 1 x 320GB SATA and 3 x 1TB SATA disks with a 30" Apple Cinema Display.
    I can import and see the video running in the source window, it can be a bit choppy but i am putting dowm to the lack of RAM (more the way). My real problem is that when I export the files the result is, well bad. I either get what appears to be a line effect every other line on the screen or by using other settings it appears grainy.
    My Cam should be recording in 1080i HD and i expect to be able to put this stuff on a DVD / Blue-Ray disk or file and see as good an image as I see in the viewfinder. This I cannot seem to do.
    Any ideas?
    Thanks
    J

    Hi
    I don't understand...please let me know...
    did media encoder work before and it just suddenly stopped working ?  Or  is this the first time you tried using it and it just doesnt work from  your original installation ?  In other words , did it EVER work for you using the HD ?
    What source material are you using ? In other words, what type of video.  MOV and AVI can have many different types of video inside those file extensions...they are called "wrappers" insomuch as they can have a lot of different "codecs" being used in the video.  Can you tell us what the video is that you're using when AME fails to work ?
    Also tell more about your computer setup...how many hard drives? Did you set up your system like recommended in many threads here in the forums ?
    There are a lot of really good and smart people here who can help you, but they need as much information as possible so they can begin to understand what is going on with your problem. It does take some time and work on your part to put all that info into a message, but it's worth it because most times problems are solved because of it.
    ps...not meant to be a criticism because you were angry about problem, but some people probably didnt respond to your trouble right away because of your initial mssg being a little bit scary..  most people here are just users like you and help each other. nobody wants to risk being yelled at or deal with someone who is just angry and isn't really supplying enough information to help solve the problem.  That's just my opinion, and I'm glad your response to my mssg was less angry sounding.  Whew !

  • Need help in URL Service Data Control

    Hi Everyone,
    I'm working on JDev11gUp2, ADF-RC
    I am using URL Service Data Control to fetch data from CSV File and i got success but I need to know that is there any way to pass File Connection URL Dynamically at run time, As i know we have to provide URL string at design time, but i have multiple files to pass at run time , Then?
    And one more question that Once the data is uploaded into af:Table from my CSV file. then after Any data change in CSV file must reflect in af:table with that change like other iterator refresh functionality. but I'm not able to do that, Simple question is, How to Re fetch the data from CSV file at run time?
    Your answer would be really appreciated as it would really help me.
    Thanks
    Fizzz...

    Hi Fizz,
    Not sure of the answer to your specific question. A couple of thoughts, though:
    You could try putting some code in a backing bean action listener to get the data control from an iterator binding (where you have added an iterator binding to your page definition) and then using the debugger to inspect the runtime type of the data control returned - then look to see if that type has a setURL method.
    [url http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b25947/adv_data_controls005.htm]this link talks about creating your own data control type - where you could certainly expose a method to set a URL. More work, but you have complete control.
    Hope this at least gives you an idea or two.
    John

  • Flash CS5 Newbie - Need help adding URL link to animated banner

    I apologize if this is a very basic question, but I am a newbie at designing in Flash. I have created a basic animation in Flash CS5 and I need to add a clickable URL link to it. I've tried a few tutorials that looked promising, but none of them solved my problem. I've tried a number of things including converting parts or all of the images to simple buttons or movies and linking them that way as well as typing in code for ActionScript 2 and 3, none of which were successful. The animation plays correctly when viewed in my browser, but when I click on it, the link does not work. I would prefer that the entire banner be clickable to take viewers to the linked website rather than using hyperlinked text. Also, when I open the Code Snippets window, it is empty, no matter what image or frame I've selected. Do I need to import code snippets from somewhere or am I simply going about things the wrong way? Any help is greatly appreciated!

    It all depends whether you're decisively using AS2.0 or AS3.0 .
    In the latter, you would need to use a URLRequest() method in conjunction with a navigateToUrl() call (not sure the exact syntax for navigate to Url, it might be a capitalized "URL" in the method but the request takes a String argument such as http://www.adobe.com)

  • Need help with URLs (Mamp/Dreamweaver/Apple Lion)

    I'm in the midst of a major upgrade - Apple Leopard > Lion and MAMP 1.x to 2.0.5. I also installed CS3, with Dreamweaver, on my new laptop.
    Anyway, everything seems to be falling in place, except for one major snag - I can't view my web pages in a browser.
    On my old laptop, I have it set up so that I can view each of my websites at a simple URL, like this: http://SL. My sites are stored in a top level folder named Sites.
    I used the settings in my old computer as a guide in setting up a site in Dreamweaver and MAMP/Hosts on my new laptop, but I can't view a page at http://SL. http://localhost/SL and http://localhost don't work, either, whereas http://localhost:8888 prompts a "Forbidden" message.
    However, I can access phpMyAdmin at http://localhost:8888/phpMyAdmin/?lang=en-iso-8859-1&language=English
    When I was setting up the site in Dreamweaver, I got the following error message:
    "Dreamweaver cannot use the prefix you entered to displaly live data. Please double-check your site configuration or click on Help for more information on how to correct this problem. (HTTP Error: 0)." I didn't explore the Help menu immediately, and I can't recreate the error message now.
    I read somewhere that I should put my html folders in the htdocs folder so I tried that with one site, with the same result.
    Anyway, can anyone tell me what I have to do to make a website located at Users > (Me) > Sites > SL display at http://SL?
    Thanks.

    In MAMP Pro setup ports for Apache/MySQL to 80/3306 then setup virtual host in Hosts tab. MAMP doesn't allow extending virtual hosts, only MAMP Pro does that. Are you using MAMP or MAMP Pro?
    best,
    Shocker

  • Urgent Need Help - APEX URL can't work when computer conncects to Internet

    I have installed APEX on my computer. But APEX can't use until computer works offline.
    If I connect to internet. Using following URL
    http://localhost:8080/apex
    I get below message.
    Internet Explorer cannot display the webpage
    I also use IP address/computer name to test, it doesn’t work either.
    But If I work offline, APEX can work.
    I tried to disable IPv6 on my computer, but it still doesn't work.
    My OS is Win7. I changed my OS recently, last OS was Windows XP and APEX worked correctly.
    Can anyone help for this?
    Thank you in advance.

    Disable proxy configuration for your localhost (or add as an exception thru Manual configuration). Your network is not finding your host when researching the path (in the internet) to reach it.

  • Need help redirecting URL to my iweb.

    I can not get my web address www.migrantpharmworkers.com redirected to my iweb site built on mac.com
    The service hosting my name said all is correct on their end. Now I can not even see my site when logged onto my .mac account. Would appreciate any help or referral to someone that does this for a living (willing to pay for this).
    Thanks

    I can not get my web address www.migrantpharmworkers.com redirected to my iweb site built on mac.com
    Someone put garbage in the url which points to your .mac site. It currently reads
    http://tp://web.mac.com/cvretis/migrantpharmworkers.com/Welcome.html
    and it should read
    http://web.mac.com/cvretis/migrantpharmworkers.com/Welcome.html

  • Need help with url for mx:HTTPService

    I inherited a Flex project and I do not have much experience with Flex.
    I have a mxml file with a HTTPService defined where the url is defined as such
    <mx:HTTPService id="domainFetcher" contentType="application/xml" resultFormat="e4x"
            url="{XXX.xxxPrefix}queries.php" method="POST" result="domainResultHandler(event)">
            <mx:request xmlns=""><ListDomainTree/></mx:request>
        </mx:HTTPService>
    I cannot determine how {XXX.xxxPrefix} is defined. When I make changes on the target web location I do not see the changes. If I remove the {XXX.xxxPrefix} then I do.
    So, it looks like {XXX.xxxPrefix} is pointing to another location that I cannot determine.
    I hope someone can help me with how to find out how the value of {XXX.xxxPrefix} is getting set.
    Thanks

    Use network monitor(it is a feature in Flash builder) to determine the url, also, XXX.xxPrefix? is it a property of the class where this httpservice is defined? I still do not understand what you mean by the following line.. Use debugger to find out whats in the prefix thing. Still your question does not have clarity, may be you should post more code.
    I inherited a Flex project and I do not have much experience with Flex.

  • Need help for URL

    I got my domain from godaddy.com. and for example my domain name is www.needhelp.com
    when i do publishing on .mac, it changes the url to www.needhelp.com/site/blog OR something like that.
    I want it so that when people type www.needhelp.com on their browers, the homepage will make the brower stay at www.needhelp.com instead of adding all these other extensions or whatever
    someone please help

    so youre saying that i cant edit my website with iWeb?
    Not at all. Doing Domain Forwarding/Masking at Godaddy has no connection with how you edit and publish your site.
    But if you have already gone through he process of making a www CNAME entry at Godaddy, and setting your .Mac Account Settings for a personal domain, as required by the .Mac personal domain feature, you need to undo all that.

Maybe you are looking for

  • Disappearing plot line when zoomed

    I am having a problem with my CNiGraph plot line disappearing when the axes min and max are explicitly defined and they are substantially smaller than they would be if the graph were autoscaled.  I am using measurement studio 8.6.1.465 and NiDaqmx 9.

  • Web service call failed using WCF

    Hi, I generated a proxy with WCF and call web service 2.0. The soap message sent is: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecu

  • XIAxisAdapter queary

    Hi I had a scenario where i am using Soap (Axis) adapter at my sender side (have used WS Secutiry UserTokenAuthorization). When i publish this service at SR (published from the option in sender agreement), the End points that got generated is like th

  • Some very weird issue with Motion tween

    Hello, guys! I confronted some kind of weird problem. I uploaded it in fla, https://www.dropbox.com/s/u9bkjiokk51m1o3/landscape_START.fla. Soo, about the problem, flowers in layers 8,9,10 act wrong, when im trying to apply motion tween, they move fro

  • Set Domain in SIP INVITE

    Hi all, for authentication reason our SIP provider requires the "from: user@host" field in the SIP INVITE message to have a domain.xy as the host section. So far the router (3660 with IOS 12.3(14)T) only uses its ip address as host part. Does any one