JSP URL encoding

Hi I've got this link that leads me to print_article.jsp. When I use the link, the encoding fine in the page that I get to. So in print_article.jsp, when I call ${param.title} it displays 'Assurance m�dicale � la carte', as it should.
If I cut and paste that URL in a new browser, the encoding for ${param.title} is wrong. ${param.title} gives Assurance m�dicale � la carte.
here is the URL in question:
http://localhost/print_article.jsp?page=/assurance-voyage/trouver-produit/liste-protections/plan-medicaux/assurance-medicale-carte.fr.html&title=Assurance%20m�dicale%20�%20la%20carte&lng=fr
I tried forcing the encoding using utf-8, windows-1252 and ISO-something and none of those work.
I encoded the URL ( and only the param.title part ) using java.net.URLEncoder. That didn't work either.
I tries IE7, firefox, got the same behavior
What has me baffled is that all works fine, except when I cut and paste the URL in a new browser, new window, the I lost the encoding on the parameter title.
Any idea?

Design advice that solves the problem:
Don't send whole title as url parameter, send only some article id and get all the other article attributes using this id.

Similar Messages

  • Hi, how to use URL encoding in jsp

    hi, how to apply URL encoding in jsp for a string, could u pls suggest some ideas to use URL encoding in jsp
    thank you in advance

    hi, thnx for the reply, but my problem is to use url encoding method
    i would u like to know how to represent in jsp program i have asp code some thing like this
    href='/project/tel_number.asp?team=<%=DbRecTeam("id")%>&name=<%=Server.URLEncode(DbRec("name"))%>'
    i would like to know how replace that Server.URLEncode stmt in jsp, could u pls suggest some equivalent method for the above stmt
    thanx in advance

  • Filter does not work with *.jsp URL pattern???

    Hi All,
    I am, by no means, very good at JSF or Java. I have looked at various forum posts on here for ways to implement a security filter to intercept requests to pages that first require one to be logged in, and if not, redirect them to the login page. Yes, I know a lot of you have heard this many times before, and I'm sorry to bring it up again.
    BUT, from the guidance of other posts, I have got a filter that works fine when the url pattern is set to "/faces/*" or "/<anything>/*", however it won't work for "*.jsp" or "*.<anything>"
    My filter is as follows:
    package test.security;
    import javax.faces.context.FacesContext;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((test.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((test.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                       // try {
                     //       FacesContext.getCurrentInstance().getExternalContext().redirect("Page1.jsp");
                      //  } catch (ServletException ex) {
                      //      log("Error Description", ex);
                        res.sendRedirect("../Page1.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }My web.xml declaration for the filter is:
    <filter>
      <description>Filter to check whether user is logged in.</description>
      <filter-name>SecurityFilter</filter-name>
      <filter-class>test.security</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>SecurityFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    Note: I have also tried this with <url-pattern>*.jsp</url-pattern> for the filter mapping in place of the Faces Servlet
    My web.xml declaration for the url pattern is:
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>Which JSC/NetbeansVWP automatically creates a "JSCreator_index.jsp" which has:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root  version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page">
      <jsp:forward page="Page1.jsp"/>
    </jsp:root>When run, this causes an Error 500 in the browser and a NullPointerException in SecurityFilter.java on the line:
    if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */I think I'm missing something that would be obvious to anyone who knows better than me. Any ideas?

    Dear Ginger and Boris,
    thanks for the information - the problem seems to ocur in EP7 as well, Boris told me it is fixed in SP15. We are on SP14 now, so there is hope !
    actually the information in the oss note stated above is also true, as we have an Oracle DB. On a similar demo system (only difference is SQL DB) the hyphen search works !
    best regards, thank you !
    Johannes

  • Url Encoding and decoding

    Hi All,
    I am trying to encode the url, pass spme parameters and decode them in another jsp.
    Encoding:
    <a href="<c:url value="abc.jsp">
                        <c:param name="folder" value="${sectionValue.foldername}"/>
                        <c:param name="filen" value="${fn:trim(sectionValue.filelink)}"/>
                        </c:url>"
                        target="_blank">${sectionValue.filename} (${sectionValue.filetype})</a>Decoding in abc.jsp
    <%
    out.clear();
         out = pageContext.pushBody();
         String path ="E:\\web\\forms\\Current\\";
         String folder = request.getParameter("folder");
         String filen = URLDecoder.decode(request.getParameter("filen"), "UTF-8");
         path=path+folder+"\\"+filen;
         System.out.println(path);
    %>When I print this path, it still is T L Fam12.19.08.pdf instead of T + L Fam12.19.08.pdf.
    It is encoding correctly , cause it is T%2bL%2520Fam12.19.08.pdf
    Thanks

    It is encoding correctly , cause it is T%2bL%2520Fam12.19.08.pdfIt looks like at least part of it has been encoded twice.
    %25 decodes to a % sign.
    So it would have been encoded once, space converts to %20
    Encoded a second time %20 --> %2520 (encodes the % sign)
    What is the value of "${sectionValue.filelink}" that you are encoding?
    Does it already have the %20 in it?

  • URL ENCODING

    hi,
    I am devoloping using JSP pages and servlets on JRUN web server. I found that when the browser passes the URL (along with my custom parameters) to the servlet, it encodes any spaces in my parameter values with '%20'. Now am I correct that this is done using Base64encoding?? However, I am not using any encoding mechanism and this automatic conversion seems to cause a problem in that the web server thinks that it needs to authenticate this URL and is unable to process it. Does anyone know how I can turn this encoding off and pass any spaces in my parameter values as they are, or is there any other known solution to this.
    Any help will be much appreciated.
    Thanks

    hi,
    I am devoloping using JSP pages and servlets on JRUN
    web server. I found that when the browser passes the
    URL (along with my custom parameters) to the servlet,
    it encodes any spaces in my parameter values with
    '%20'. Now am I correct that this is done using
    Base64encoding?? All browsers will do this, and it's called "URL encoding". It's a little trick to use other characters than simple letters and digits in URLs (including parameters). This has nothing to do with Base64 encoding.
    However, I am not using any encoding
    mechanism The browser uses this encoding, and you (the server) cannot do anything about it. It shouldn't actually be a problem at all.
    and this automatic conversion seems to cause
    a problem in that the web server thinks that it needs
    to authenticate this URL and is unable to process it.I think you're making a mistake here. URL encoding has nothing to do with URL authentication. I guess you mean that the webserver is requesting username/password ? Then you have configured the requested URL to be authenticated at yuor webserver.
    Does anyone know how I can turn this encoding off and
    pass any spaces in my parameter values as they are, or
    is there any other known solution to this.You really don't want to turn URL encoding off. Next, it can't be 'turned off'. Jrun will automatically decode the %20 to a space again; you won't notice it has been encoded at all.
    Your problem must be somewhere else. Have a close look at your http authentication settings...
    >
    Any help will be much appreciated.
    ThanksNo problem
    Cheers,
    Tom

  • Newbie ERROR- URL Encoded SQL Length exceeds allowed 32K limit

    My SQL Query worked fine yesterday.( I'm still in developing mode)
    I made a copy of it and put it into a text file.( Just to be sure I had it.)
    Today When I tried to run it in APEX , I get error
    URL Encoded SQL Length exceeds 32K limit.
    Is there any way to tell how the size of my query ( for example 33K)
    is using?
    TIA
    Steve42

    I had to put out some other fires for the last few days.
    I'm trying to use it in SQL worksheet.
    That is my entire error message. It does NOT have an Error #.
    Product Build: 3.0.0.00.20
    TIA,
    Steve42

  • XML to URL Encoded (XSLT?)

    I have some data in a Document object and need to convert it to URL encoded format so, for example this:
    <share>
    <code>GSK</code>
    <price>13.34</price>
    </share>
    becomes something like...
    &code=GSK&price=13.34& ...
    I've been looking into doing this with XSLT but have run into difficulties. Do you think this is the best way of solving this problem, or is there another easier way?
    Thanks.

    I did something similar, basically takes a incoming XML file and output a HTML with certain link containing XML element value as query string. One of the things you have to be careful is, like Dr. Clap mentioned, to properly encode the value. I accompolished by using java extension in my XSL.
    For example:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:encode="java.net.URLEncoder"
              extension-element-prefixes="encode"
              version="1.0">
         <xsl:template match="/">
              <xsl:variable name="myURL" select="concat('?blah=', encode:encode($myValueFromXML))" >
         </xls:template>
    </xsl:stylesheet>

  • URL Encoding and UTF8

    Hello Friends,
    I have been working on this problem for some time now. I have a web page that has forms fields like first name, last name etc. and then posts the data back to a servlet that writes it into a file that is utf-8 encoded. The web page has charset specified as utf-8. I was assuming that data would be sent back in the url as utf-8. I entered some japanese data copied from a japanese web page. When I looked at the file into which the form data was written I saw that it wasn't even close to utf-8 or unicode encoding of the data I had posted. For eg. I entered a japanese character: '\u4F1A' which is utf-8 encoded as 'E4 BC 9A'. But the data written into the file is '25 45 34 25 42 43 25 39 41'. This is of course because the data is url encoded which is '%E4%BC%9A', since 45 is hex for E, 34 is hex for 4 and so on. Now the question is how is it that I proceed to get the right utf data back. I am using a jrun server. Is there something that I need to set here in order to get the right characters back.

    The UTF-8 encoded sequence of bytes of the character '\u4F1A' is {-E4, -BC, -9A}, and the character '-' is (char)0x2d instead of (char)0x25. And I suppose 25 should be 2d.

  • URL Encoder not working in Netscape

    Hi All,
    I am using url encoding in my servlet for redirecting a request. The query string values has some spaces in them. The code I have used is shown below
    String mname = "Jason Perry"
    response.sendRedirect
    ("http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp="+price.toString()+"&mname="+URLEncoder.encode(mname)+"&mtxnid=UY675432");
    Please note that 194.216.8.238:8081 is an IP of another server located outside our network.
    In Netscape the url is shown as http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp=15
    &mname=Jason Perry&mtxnid=UY675432
    The space is not getting replaced with the plus.
    But I have observed that if the redirection is to the same server on which the servlet is running, it works fine.
    I am at loss as to why url encode is not working when routing the request to another server. I am using Netscape 4.77 .
    This is works in IE fine.
    Your inputs are appreciated.
    Thanks
    Malini

    Yeah had this problem before, use the java.net.URLEncoder class:
    <%@ page language="java" import="java.net.URLEncoder"%>
    <%
    String url = "http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp=15
    &mname=Jason Perry&mtxnid=UY675432"
    String encodedUrl = URLEncoder.encode(url);
    response.sendRedirect(encodedUrl);
    %>

  • Apache plugin url encoding

    the following is on HP Apache-based Web Server/1.3.26
    with the mod_wl.so from 6.1 sp3 proxying to a 6.1 sp3 backend and I tried setting
    up QueryFromRequest ON to no avail.
    I am having the following problem with the BEA proxy plugin for Apache. I have
    a very simply scenario to demonstrate it. Lets say that you have the following
    directory/file structure:
    /applications
         /DefaultWebApp
              spaceLink.htm
              /space demo
                   resource.htm     
    NOTE: There is a "space" in the "space demo" directory name.
    Now, spaceLink.htm has a link to the file resource.htm in the "space demo" directory.
    Here is the html:
    <html> <body> click here </body> </html>
    Now assume that apache is sitting in front of this BEA box and proxying requests
    to the BEA box.
    If the Apache-BEA proxy plugin is proxying the request to BEA, then the request
    is made correctly from the browser to the proxy as:
    GET /space%20demo/resource.htm HTTP/1.1
    Notic the browser is correctly URL encoding the request.
    BUT, the apache-BEA proxy plugin is incorrectly proxying the request to the BEA
    box:
    GET /space demo/resource.htm
    Notice the Apache-BEA proxy is not URL encoding the request, so when BEA gets
    it he thinks this is a request for "/space" and "demo/resource.htm" is the http
    version.
    This problem DOES NOT happen if I use the generic http proxy module provided with
    Apache.
    Has anyone seen this problem before?
    Please get back to me if you have some information.
    Thanks,
    Cole Crawford
    Paymentech

    the following is on HP Apache-based Web Server/1.3.26
    with the mod_wl.so from 6.1 sp3 proxying to a 6.1 sp3 backend and I tried setting
    up QueryFromRequest ON to no avail.
    I am having the following problem with the BEA proxy plugin for Apache. I have
    a very simply scenario to demonstrate it. Lets say that you have the following
    directory/file structure:
    /applications
         /DefaultWebApp
              spaceLink.htm
              /space demo
                   resource.htm     
    NOTE: There is a "space" in the "space demo" directory name.
    Now, spaceLink.htm has a link to the file resource.htm in the "space demo" directory.
    Here is the html:
    <html> <body> click here </body> </html>
    Now assume that apache is sitting in front of this BEA box and proxying requests
    to the BEA box.
    If the Apache-BEA proxy plugin is proxying the request to BEA, then the request
    is made correctly from the browser to the proxy as:
    GET /space%20demo/resource.htm HTTP/1.1
    Notic the browser is correctly URL encoding the request.
    BUT, the apache-BEA proxy plugin is incorrectly proxying the request to the BEA
    box:
    GET /space demo/resource.htm
    Notice the Apache-BEA proxy is not URL encoding the request, so when BEA gets
    it he thinks this is a request for "/space" and "demo/resource.htm" is the http
    version.
    This problem DOES NOT happen if I use the generic http proxy module provided with
    Apache.
    Has anyone seen this problem before?
    Please get back to me if you have some information.
    Thanks,
    Cole Crawford
    Paymentech

  • Problem in URL Encoding  in J2ME

    Hi,
    I have a problem in URL Encoding in J2ME. As i read thru the J2ME APIs, i found that J2ME doesn't support it.
    Or can i use the URL Encoding in J2SE to modify and put into J2ME?
    Or someone out there have done such coding?
    Reply me!
    Thanks!...

    like this:
    public static String URLEncoder(String str) {
    if (str == null) return null;
    StringBuffer resultStr = new StringBuffer( str.length() );
    char tmpChar;
    for( int ix=0; ix<str.length(); ix++ ) {
    tmpChar = str.charAt( ix );
    switch( tmpChar ) {
    case ' ' : resultStr.append( "%20" );
    break;
    case '-' : resultStr.append( "%2D" );
    break;
    case '/' : resultStr.append( "%2F" );
    break;
    case ':' : resultStr.append( "%3A" );
    break;
    case '=' : resultStr.append( "%3D" );
    // System.out.println( "tmpChar = '=' " + "add %3D " );
    break;
    case '?' : resultStr.append( "%3F" );
    // System.out.println( "tmpChar = '?' " + "add %3F " );
    break;
    case '#' : resultStr.append( "%23" );
    break;
    case '\r' : resultStr.append( "%0D" );
    break;
    case '\n' : resultStr.append( "%0A" );
    break;
    default : resultStr.append( tmpChar );
    break;
    return resultStr.toString();
    }

  • I have a string in URL encoded format. How do I unencode?

    I'm sure there is a single command for this but I can't find it, so my workaround is a long list of 'replace' commands :-(
                    vari = vari.replace(/%22/g,"'");
                    vari = vari.replace(/%20/g," ");
                    vari = vari.replace(/%3C/g,"<");
    etc.
    Help!!! How do I unencode  my URL encoded string?

    http://livedocs.adobe.com/flex/3/langref/package.html#unescape()
    try this link..
    unescape(); function.. it is a global function
    hope this helps,
    BaBo,

  • Sending document to oracle xml gateway web service and body is url encoded

    Hello,
    a question from a complete newbie to web services. I have some code that is sending a soap message to an oracle xml gateway web service. In the soap message the values in the soap body look like &lt ;CNTROLAREA&gt ;
    when I would be expecting <CNTROLAREA>. What I have been told is that the content of the ReceiveDocument element has been url encoded which causes the &lt and to correct it I need to change the paramater type from object to xmlnode and to build the request as an xmldocument. The xmlnode and xmldocument comes from a .net guy so I've been trying to find the equivalent in java but am not having any luck. I have a lot of reading to do but was wondering if someone might be able to point me in the right direction on how to correct the problem. I captured the soap message being sent using tcpmon. Why does the body have the &lt instead of the < as I was expecting and is there an xmldocument type? The header part of the soap message looks as I expect. "><soapenv:Header><ns1:XMLGateway_Header xmlns:ns1="http://xmlns.oracle.com/apps/fnd/XMLGateway"><ns1:MESSAGE_TYPE>XML</ns1:MESSAGE_TYPE>. It is being sent as a com.oracle.xmlns.apps.fnd.XMLGateway.XMLGateway_Header type.
    thanks
    Thanks
    Edited by: twf123 on May 5, 2010 11:59 AM
    Edited by: twf123 on May 5, 2010 12:00 PM

    twf123 wrote:
    What I have been told is that the content of the ReceiveDocument element has been url encoded which causes the &lt and to correct it I need to change the paramater type from object to xmlnode and to build the request as an xmldocument. Where do you change the parameter type?
    The xmlnode and xmldocument comes from a .net guy so I've been trying to find the equivalent in java but am not having any luck. How do you get the data from .net guy? Which interface do you use? What processing do you do after receiving the data?

  • URL encoding special characters in episode name

    Hello,
    Configuration :
    1 capture agent on a MAC MINI under MAC OS X 10.6.5
    1 PCP2 server on an XServe under MAC OS X 10.6.5
    I encounter this problem since 10.6.5 update :
    When I stop a Podcast capture, if episode name is for example abcd#, '#' character is "URL encoded" to '%23' sequence. So the final file name of the podcast is abcd%23.m4v instead of abcd#.m4v.
    This was not the case under 10.6.4.
    I tried this solution : renaming the file adding a task in the workflow ; this task launches a bash script which renames all files replacing '%23' sequences by a '#' character.
    Files are well renamed, but the task don't give hand back, and XGrid task never ends.
    Got this error in /var/log/system.log :
    sandbox [nnn] : bash(12146) : deny file-ioctl /path/to/bash-script
    Thanks for help

    Problem solved !
    I had a problem with rights on my podcasts directory.
    So, for those who are interested, you can add a task to your workflow, for example a bash batch file which renames all files in your podcast directory whose name contains a special character :
    for fic in `ls`
    do
    mv $fic `echo $fic | sed -e s/%23/#/g`
    done
    the additional workflow task must contain 2 items :
    --- an item "command" of type String with the path of your batch file as value
    --- an item "dependsOnTasks" of type array with an element of type string with "postflight" as value

  • XSL and url encoded data issue

    I have a large XML document, which has the data in it URLEncoded to escape the nasty chars.
    When I run it through the xalan XSL parser and feed the output to the browser in my servlet, the resultant html has the URLEncoded chars in it. For instance the '/' is still showing up at %2F etc... However, if I can't URLDecode the whole xml document. Is there a simple way for decode the URL chars, without doing too much trickery?
    Thanks!
    Modoc

    You can URL-encode XML data if you like, whatever you mean by "nasty chars" I don't know. The result is perfectly legitimate XML and XSLT will translate it perfectly well. But it won't decode it, that is none of its business. I suppose it would be possible to write an XSLT function to do URL-decoding, but my preference would be to do that some other way. Or not to URL-encode in the first place.

Maybe you are looking for

  • Communication problem with proxy server

    We have establish the configuration of an iPad to access the enterprise net, but when trying to access any webpage we get the next message: Safari can not open the page. Error:"There is a communication problem with proxy web server (HTTP)" The access

  • A Very New and Cool Suggestion for a *PLAIN TASKBAR*

    Hello, I have a very different kind of suggestion for the TASK BAR. I was listening to songs when a video song came, the video was playing in the background.. i didn't realize that , when i saw the task bar, i liked the way how the transparent task b

  • Hard Disk Failure - Please Help

    Hi, I have a HP probook 4730s. The laptop is 13 months old and the warranty has expired. The HDD has been laging lateley and also the system restore took, the last time it was ran took longer as usual, now at the startup i receive a message that the

  • InfoPath and SDP not allowed: Use Form or document to solve requirements?

    Dear all I work in a company which has supplied SharePoint 2007 with limited user rights on operational level: No use of SharePoint Designer, InfoPath, VisualStudio. But we can customize SharePoint sites with administrator rights. My department inten

  • Camera Raw 4.6 and DNG Converter available on Adobe Labs

    http://labs.adobe.com/wiki/index.php?title=Camera_Raw_4.6 Additional Detail Here: http://blogs.adobe.com/lightroomjournal/2008/09/camera_raw_46_and_dng_converte.html Regards, Tom Hogarty Lightroom, Camera Raw, DNG Product Manager