EL: escaping HTML

Discussion in 'Java' started by Timo Nentwig, May 8, 2004.

  1. Timo Nentwig

    Timo Nentwig Guest

    Hi!

    I need to escape HTML - can this be done with EL alone? For a matter of
    quotations marks I cannot use JSTL in a plain JSP:

    <a href="javascript:f('<c:eek:ut value="problem"/>')">

    Timo
     
    Timo Nentwig, May 8, 2004
    #1
    1. Advertising

  2. Timo Nentwig

    Murray Guest

    Re: escaping HTML

    "Timo Nentwig" <> wrote in message
    news:...
    > Hi!
    >
    > I need to escape HTML - can this be done with EL alone? For a matter of
    > quotations marks I cannot use JSTL in a plain JSP:
    >
    > <a href="javascript:f('<c:eek:ut value="problem"/>')">
    >
    > Timo


    Why can't you use JSTL? I don't understand...
     
    Murray, May 8, 2004
    #2
    1. Advertising

  3. Re: escaping HTML

    Hi,

    >> I need to escape HTML - can this be done with EL alone? For a matter of
    >> quotations marks I cannot use JSTL in a plain JSP:
    >>
    >> <a href="javascript:f('<c:eek:ut value="problem"/>')">


    in JSP 2.0 you can use:

    <a href="javascript:f('${problem}')">

    for JSP 1.2 you can stick to taglibs if you want to have the file
    well-formed. Are you using struts? Then you can do:

    <html:link href="javascript:f('${problem}');">link label</html:link>

    Regards,

    Tobias
    --
    <http://www.schierge.de/tobias/>
     
    Tobias Schierge, May 9, 2004
    #3
  4. Timo Nentwig

    Timo Nentwig Guest

    Re: escaping HTML

    Tobias Schierge wrote:
    > <a href="javascript:f('${problem}')">


    The problem of problem is that is it contains quotation marks....
     
    Timo Nentwig, May 9, 2004
    #4
  5. Timo Nentwig

    Timo Nentwig Guest

    Timo Nentwig wrote:
    > Hi!
    >
    > I need to escape HTML - can this be done with EL alone? For a matter of
    > quotations marks I cannot use JSTL in a plain JSP:
    >
    > <a href="javascript:f('<c:eek:ut value="problem"/>')">
    >
    > Timo


    ${fn:escapeXml(problem)}
     
    Timo Nentwig, May 10, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Timo Nentwig

    JSP2/EL: escaping HTML

    Timo Nentwig, Apr 29, 2004, in forum: Java
    Replies:
    0
    Views:
    353
    Timo Nentwig
    Apr 29, 2004
  2. Csaba2000

    Reverse escaping in HTML

    Csaba2000, Jan 17, 2004, in forum: HTML
    Replies:
    1
    Views:
    856
    Brian
    Jan 17, 2004
  3. Jim Bancroft

    help w/HTML escaping in XML tags?

    Jim Bancroft, Mar 2, 2005, in forum: XML
    Replies:
    5
    Views:
    1,139
    Peter Flynn
    Mar 6, 2005
  4. Alan Silver
    Replies:
    6
    Views:
    524
    Alan Silver
    Jun 12, 2006
  5. Sean T Allen

    library for doing html escaping...

    Sean T Allen, Apr 29, 2005, in forum: Ruby
    Replies:
    2
    Views:
    108
Loading...

Share This Page