Handling quotes with ${param.CurrentName}

I've read many posts on this topic, but cannot find a solution that works for my problem. I have 2 JSP pages. JSP 1 has text field CurrentName. JSP2 tries to capture that value and store it:<input type="hidden" name="CurrentName" id="CurrentName" value="${param.CurrentName}"> This of course works great, unless the user types in double quotes, like Joe "Cool" Johnson. If that happens, JSP2 contains <input type="hidden" name="CurrentName" id="CurrentName" value="Joe "Cool" Johnson"> Of course, the real data is cut off after Joe<space> because of the quote around "Cool." If I use single ticks like value='${param.CurrentName}', it works great with double quotes but not with single quotes, like Suzie's Kitchen, as we get the same data cutoff error after Suzie.
So, of course the answer is to encode the value, replacing \" with ". But when I'm using default param and not a bean, I can't do this in a Java POJO. If I try calling a JavaScript method like fixquote(${param.CurrentName}); the result thows an error as fixquote(Joe "Cool" Johnson); If I try to capture the param in a variable first, it also throws an error.String paramname1 = ${param.CurrentName};results in String paramname1 = Joe "Cool" Johnson; and I can't pass paramname1 on the next line because it's already errored. I tried ${fn:replace(${param.CurrentName}, "a", "b")}; and that failed too.
I'm not sure how I can actually pass that data to any method, Java, JSTL or JavaScript, because it translates the real value causing an error before I can pass it. I thought about using a bean from JSP1 to JSP2, but in this application I inherited, there are about 100 parameters on this page I'd need to add, so am hoping to avoid that work.
Thanks.

That last one was the closest to what you need to do. You just had some nested ${ expr } braces which doesn't work so well.
// fixed example
${fn:replace(param.CurrentName, "a", "b")};
// I think it should look something like this
${fn:replace(param.CurrentName, "\"", "\\\"")};Alternatively you could create a class wraps the parameter map, and escapes values for you.
You could then replace all instances of "param" with references to this bean instead.
cheers,
evnafets

Similar Messages

  • How to replace one double quotes with two double quotes in XSLT

    How can I replace one double quote to a two double quote in a string in XSLT
    I am passing the parameter string to XSLT template contains the value as
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    I nead the output as
    Hi! ""How are you.
    Tried with Translate function, but it did not work out
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', VQuotes)" />
            </xsl:element>But it is giving the same result as Hi! "How are you
    When I tried with
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', 'BB')" />
            </xsl:element>
    It gave the result as
    Hi! BHow are you.
    It is replacing only one character with one. how to make it for two characters.
    Am I doing anything wrong in syntax?
    Please help.
    Regards, Vignesh S

    Hi Vignesh,
    Try this.
    Its a two step process:
    Step1: Add the following template would be "called" to do the replacement as your want:
    <xsl:template name="string-replace-all">
    <xsl:param name="text" />
    <xsl:param name="replace" />
    <xsl:param name="by" />
    <xsl:choose>
    <xsl:when test="contains($text, $replace)">
    <xsl:value-of select="substring-before($text,$replace)" />
    <xsl:value-of select="$by" />
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text"
    select="substring-after($text,$replace)" />
    <xsl:with-param name="replace" select="$replace" />
    <xsl:with-param name="by" select="$by" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Step2: Call the above templeate in the place where you want to call, like this:
    <!--Define the variables-->
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="sQuotes">"</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    <!--Following call the template which you have defined in step1-->
    <xsl:element name="DESCRIPTION_SHORT">
    <xsl:variable name="myVar">
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text" select="$Description" />
    <xsl:with-param name="replace" select="$sQuotes" />
    <xsl:with-param name="by" select="$VQuotes" />
    </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="$myVar" />
    </xsl:element>
    I have tested this and works. And outputs as the following with two-double quote as you want.
    <DESCRIPTION_SHORT>Hi!
    ""How are you</DESCRIPTION_SHORT>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Is there any string tokenizer that handles quotes?

    I need a string tokenizer that handles quotes in LabVIEW.
    Assume that there is a string, abc bcc="xxx yyy"
    After tokenizing, token 1 is abc, and token 2 is bcc="xxx yyy".
    The tokenizer should ignore white characters between quotes.
    I use LabVIEW 2009 SP1.
    Does anyone have a tokenizer VI?
    Solved!
    Go to Solution.

    I expect that I can make something cleaner if I had a better understanding of your expected input, but this works with what I know.
    The bottom loop looks for start & end quotation marks and pastes the elements together that the first loop shouldn't have (based on your requirement) taken apart.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    Untitled 2.vi ‏15 KB

  • Find and replace smart quotes with straight quotes?

    I understand I can turn off smart quotes so that I can type straight quotes, but I need to replace hundreds of curly smart quotes with straight quotes, is there a feature that will let me do this? I am using FM8.
    Thanx,
    Willian

    I am using FM9....so I don't know if the same shortcuts apply, but this is what I found out last week.
    Use the Find and Replace tool:
    With smart quotes turned off and the Num Lock key turned on:
    Alt0147 will give you beginning quotation marks
    Alt0148 will give you ending quotation marks
    In the Find box use ALT0147 or ALT0148 for the beginning or ending quotes. When you click in the box and type
    one of the shortcuts the correct quote will be shown in the box.
    In the replace box type the regular straight quotes on your keyboard.
    I was thrilled that it would work!...course you do have to do them separately and be careful not to replace the curly quotes
    that you want to leave in your document.
    Hope this helps using FM8....
    ls

  • How to replace single quote with double quote

    hai all,
    i have a problem,
    i am trying insert a string containing single quote into ms-access database.
    it is giving error.
    how can i avoid this .if i replace a single quote in the text with double quote it will defenitely
    insert into database.
    in java.lang.String
    replace () will not work to replace quote with double quote.
    any otherway to solve this problem.
    please mail me to [email protected]
    thank you
    sambareddy
    inida

    java.lang.String.replace () will not work to replace quote with double quote.Really?
    String x = ...
    x.replace( "'", "\"" );

  • Replacing " (double quote) with ' (single quote)

    Hi there,
    I have the following method to manipulate user input. All I want to do is, to replace the double quote with a single quote. The implementation I tried was,
    this.replace(desc, "\"", "'");
    This does not work for me. It jsut removes the double quote and does not introduces the single quote. Could any one please advise?
    Thanks,
    Des
    public static String replace(String line, String oldString, String newString) {
              if(line != null && oldString != null && newString != null) {
                   int index = 0;
                   while ((index = line.indexOf(oldString, index)) >= 0) {
                        line = line.substring(0, index) +
                             newString +
                             line.substring(index + oldString.length());
                        index += newString.length();
              return line;
         }

    Bad luck.. I am unable to get it still.
    This is the code I am using (implemetation is in a JSP. I am using this code to test it).
    public class Test{
    public static void main(String args[]){
         String s = args[0];
         Test t = new Test();
         String doubleQuote = "\"";
         System.out.println(" output :"+ t.replace(s,doubleQuote,"'"));
         //System.out.println(" output :"+ t.replace(s,"\"","'"));
         //System.out.println(" output :"+ t.replace('"', '\''));
    public static String replace(String line, String oldString, String newString) {
              if(line != null && oldString != null && newString != null) {
                   int index = 0;
                   while ((index = line.indexOf(oldString, index)) >= 0) {
                             System.out.println(" line count :");
                        line = line.substring(0, index) +
                             newString +
                             line.substring(index + oldString.length());
                        index += newString.length();
              return line;
    }mshn02
    The main problem is I am stuck with the server's version of Java (which I have no control on it). I could not use 1.4.2

  • How to handle dbms_xmldom with no data values.(no_data_found error in dom)

    hi,
    i have below block,
    DECLARE
    doc dbms_xmldom.DOMDocument;
    node dbms_xmldom.DOMNode;
    elem dbms_xmldom.DOMElement;
    cur_node dbms_xmldom.DOMNode;
    root_elem_data dbms_xmldom.DOMElement;
    root_elem_tab dbms_xmldom.DOMElement;
    root_node_data dbms_xmldom.DOMNode;
    mode_elmn dbms_xmldom.DOMElement;
    mode_node dbms_xmldom.DOMNode;
    mode_text dbms_xmldom.DOMText;
    doc1 DBMS_XMLDOM.DOMDOCUMENT;
    root_node_data1 DBMS_XMLDOM.DOMNODE;
    child_document DBMS_XMLDOM.DOMDOCUMENT;
    child_rootnode DBMS_XMLDOM.DOMNODE;
    V_CLOB CLOB;
    v_doc CLOB;
    v_EMP CLOB;
    v_output_filename VARCHAR2(300) := 'SPOOL_DIR/'||'EMP_XML_FILE.xml';
    l_xmltype XMLTYPE;
    BEGIN
    doc := dbms_xmldom.newDOMDocument;
    node := dbms_xmldom.makeNode(doc);
    dbms_xmldom.setversion(doc, '1.0');
    dbms_xmldom.setCharset(doc, 'UTF8');
    elem := dbms_xmldom.createElement(doc, 'PartnerInfo');
    dbms_xmldom.setAttribute(elem,'xmlns','EMP');
    cur_node := dbms_xmldom.appendChild(node, dbms_xmldom.makeNode(elem));
    mode_elmn := dbms_xmldom.createElement(doc, 'EMPLOYEE');
    mode_node := dbms_xmldom.appendChild(cur_node,dbms_xmldom.makeNode(mode_elmn));
    BEGIN
    SELECT value(e) INTO l_xmltype
    FROM TABLE(XMLSequence(Cursor(SELECT * FROM EMP1 where EMPNO=7501))) e;
    child_document := DBMS_XMLDOM.newDOMDocument(l_xmltype);
    root_node_data1 := dbms_xmldom.importNode(doc,dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(child_document)),TRUE);
    root_node_data1 := DBMS_XMLDOM.appendChild(root_node_data, root_node_data1);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    dbms_lob.createtemporary(v_doc, true);
    dbms_xmldom.writeToClob(doc,v_doc,'UTF8');
    v_EMP:= v_doc;
    dbms_xmldom.writeToFile(DOC,v_output_filename,'UTF8');
    dbms_xmldom.freeDocument(doc);
    --Dbms_Output.Put_Line('THE OUTPUT IS::'||V_EMP);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    The xml file is 'EMP_XML_FILE.xml'
    <empno>U++kYmcVuGchxbh+++++++++++++++1+</empno>
    <empname>J</empname>
    suppose the empno 7501 is not available in our emp table,
    i got error
    ORA-03113: end-of-file on communication channel
    how to handle xmldom with no data values.
    by
    siva

    hi,
    please give the solution
    by
    siva

  • Joining Quotes with Orders in OBIA Siebel Sales

    Hi Gurus,
    I need to find a way to join the Quotes with the Order in the OOTB RPD from Siebel Sales implementation. I am trying to join with the Row_WID but i do not get any results for the below query, i want to have the the Quote number and the related Order Number and details.
    select * from obaw.w_order_d a, obaw.w_order_f b, obaw.w_Quote_f c, obaw.w_quote_d d
    where a.row_wid=b.row_wid
    and b.row_wid=c.row_wid
    and c.row_wid = d.row_wid
    I am sure i am going grossly going wrong somewhere.
    Quick help will be appreciated.
    Regards,
    Amit

    Amith,Is this answered Common key to join Opportunity, Quotes & Orders
    Coming to your question,you established the joins wrong,here is the query i have written for you
    select a.integration_id ,a.row_wid,a.vis_pr_bu_id,
    b.integration_id "quote integration",b.row_wid "quote wid",b.vis_pr_bu_id "quote vis",
    c.integration_id "fact int",c.quote_wid "fact quote",c.vis_pr_bu_id "fact vis"
    from w_order_d a,
    w_quote_d b,
    w_quote_f c,
    w_order_f d
    where a.row_wid=b.row_wid
    and b.row_wid=c.quote_wid
    and a.row_wid=d.order_wid
    hope answered.
    Cheers,
    KK
    Edited by: Kranthi.K on Jun 27, 2011 9:24 PM

  • SQL Injection, replace single quote with two single quotes?

    Is replacing a single quote with two single quotes adequate
    for eliminating
    SQL injection attacks? This article (
    http://www.devguru.com/features/kb/kb100206.asp
    ) offers that advice, and it
    enabled me to allow users to search name fields in the
    database that contain
    single quotes.
    I was advised to use "Paramaterized SQL" in an earlier post,
    but I can't
    understand the concept behind that method, and whether it
    applies to
    queries, writes, or both.

    Then you can use both stored procedures and prepared
    statements.
    Both provide better protection than simply replacing
    apostrophes.
    Prepared statements are simple:
    Set myCommand = Server.CreateObject("ADODB.Command")
    ...snip...
    myCommand.CommandText = "INSERT INTO Users([Name], [Email])
    VALUES (?, ?)"
    ...snip...
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Name",200,1,50,Name)
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Email",200,1,50,Email)
    myCommand.Execute ,,128 'the ,,128 sets execution flags that
    tell ADO not to
    look for rows to be returned. This saves the expense of
    creating a
    recordset object you don't need.
    Stored procedures are executed in a similar manner. DW can
    help you with a
    stored procedure through the "Command (Stored Procedure)"
    server behavior.
    You can see a full example of a prepared statement by looking
    at DW's
    recordset code after you've created a recordset using version
    8.02.
    "Mike Z" <[email protected]> wrote in message
    news:eo5idq$3qr$[email protected]..
    >I should have repeated this, I am using VBScript in ASP,
    with an Access DB.
    >

  • Configuration problem with param or code problem

    Hi,
    Im new to this jsp. Currently, i have some some Q here. Im trying on the jsp-tutorial with
    <%@ taglib prefix="my"
    uri="./jsp2/jsp2-example-taglib.tld" %>
    <HEAD>
    <TITLE>Functions</TITLE>
    </HEAD>
    <BODY>
    <H3>Add Numbers</H3>
    <P>
    <FORM action="./compute.jsp" method="GET">
    X = <input type="text" name="x" value="${param["x"]}">
    <BR>
    Y = <input type="text" name="y" value="${param["y"]}">
    <input type="submit" value="Add Numbers">
    </FORM>
    <P>
    The sum is: ${my:add(param["x"],param["y"])}
    </BODY>
    </HTML>
    inside the text box it appear the text with ${param[[/i], may i know is it a configuration problem?
    Thx for reply

    Probably yes it is a configuration problem.
    You have a JSP2.0 container? (eg Tomcat 5)
    If your web.xml starts with this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
    Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    Replace it with this
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    That should fix it.
    http://forum.java.sun.com/thread.jspa?threadID=629437&
    tstart=0Sorry,
    I already hav
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    originaly.

  • Show abscence quota with 0 value

    Hello all,
    I need several quotas to be showed in IT2006 though their value (entitlement) is 0.
    These quotas have to be created first day of the year with 0 value entitlement, and then as the year goes by, they are increased depending on several criteria.
    These quotas are calculated via time evaluation (RPTIME00) and all of them work fine, except for this issue about when they still have a 0 value.
    Thank you very much in advance.
    Gonzalo

    with zero value quota can not be generated as andy said write a LSMW to create a quota with zero value.
    regards,
    mohammed

  • Handling Unit with multiple batches

    HI,
    Is it possible to create a Handling Unit with multiple batches, when packing a Handling Unit in a Production Order (COWBPACK)?
    Thanks

    When I create a  packing instruction (transaction POP1), I can set indicator "Indicator Batch Mix Allowed".
    Explenation:
    If this indicator is set, then several batches of the same material may be packed in one handling unit.
    Otherwise, only one batch may be packed.
    Use
    When determining the packing status, the system checks for batch mix violation.
    But I still can not create an HU with different batches.
    Can anyone help me?

  • Localized String with params - Value Binding Expression...

    Hi All:
    I see many e.g.s where a command button / or a label's value can be a localized resource string using the generic value binding expression:
    "#{bundleVarName.keyName}"
    what if the resource string has parameters? for e.g.
    button.caption = Click Me for {0}
    Can we assign a value binding expression with params for button captions etc.
    Please help - I am a newbie in JSF,,,
    regards
    -Somesh

    JSF developers have forgotten about this :)
    Use other tools for displaying such messages (f. e. JSTL) where you need to have parametrized messaged.
    But mostly, non-parameterized JSF will be enough.

  • Firefox is replacing double quotes with single quotes.

    In WordPress and at other sites where I input and save text, Firefox is replacing double quotes with single quotes when I save. It's also showing double quotes as single quotes on websites. I tried uninstalling and reinstalling, and it's still happening.

    Do you have the needed font installed?
    *http://en.wikipedia.org/wiki/Punctuation

  • Making ADF Search case insensitive without using Execute with Params??

    I have a ADF search page baed on VO. I'm not Execute with Params form, instead i'm using normal ADF search page. Is it possible to make the search case insensitive?? if yes, how to do that?

    Ok, i'll try to find out the SRDemo application using ADF BC.
    And In Execute with params form,i'm already using UPPER on both the sides of where clause.
    Say my VO query is like
    select <table name>,...
    from fnd_tables t,fnd_applications a
    where a.application_id = t.application_id
    and upper(t.table_name) like upper(:EntityName) || '%'
    Then i created the ADF paramaters form by dragging and dropping the Execute with param from data control pallette.. when i run this page and do the search, it throws the error given in my second update...Any clue why that error is coming?
    Thanks
    Senthil

Maybe you are looking for

  • View Paycheck Stub Error: (Form xyz does not exist)

    Hi Portal Knowledgeable ones, I am running EP 6.0 SP 13.  My SAP target is ECC 5.0. I have a problem in the ESS application.  When I attempt to view the paycheck stub for any employee, the portal returns the error: <b>com.sap.pcuigp.xssfpm.java.FPMRu

  • New macbook, old ipod touch.... cannot access music!!

    I recently bought the macbook pro for college. I have an iPod touch, which is basically attached to me at all times. I am trying to open up my library on this computer but it continually says that this ipod is synced with another computer and I canno

  • HT201413 Ipad Air in Recovery mode. Error Code 17

    My Ipad Air is currently in Recovery mode after several failed attempts to update the software. Error code 17 keeps coming up as I try to restore and update. Does any body know what error code 17 refers to? I am running Windows 7 with the latest vers

  • ICE Command History

    <p>Hi,</p><p>One way of getting an easy to edit command history is to use JLine as a wrapper for ICE.</p><p>You can download JLine from:</p><p>http://jline.sourceforge.net/</p><p>After you have downloaded and unzipped JLine, copy the JLine.jar file t

  • Acrobat 9 displays "fi" as upside down "?"

    I have several pdf documents where "fi" appears as an upside down "?"  It prints the same way.   If I open the same files in PDFLite (a free opensource program) everything displays and prints correctly.  Does anyone have any idea how to fix this?