[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Escaping slash '\' in JSP page

Asked by inditrozen in Java Server Pages (JSP)

Tags: JSP

Hi Experts,

Requirement is to replace the \\n in text value of bean-variable  to \n. There is a method written in Tag which does the replacement for me. See below

    /**
     * replace in a string the old string with a new string
     * @param value - whole string
     * @param oldString - old string, which will be replace
     * @param newString - new string
     * @return the whole new string
     */
     public static String replaceTitle(String value, String oldString, String newString ) {
        value = value.replace(oldString,newString);
        return value;
    }

I call this method from the JSP page as below.

<textarea class="disable" disabled>${tag:replaceTitle(contact.text,"\\n","\n")}</textarea>

Value of "contact.text " is = "some title \\n second line"

Text area in the browser displayes following text
"some title n second line"

What should I change in the JSP code so that slash (\) stays preserved.

Best Regards
[+][-]01/15/09 04:21 AM, ID: 23382601Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 05:08 AM, ID: 23382896Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/15/09 06:15 AM, ID: 23383425Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 07:49 AM, ID: 23384543Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/15/09 07:52 AM, ID: 23384574Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 09:46 AM, ID: 23385807Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/15/09 10:11 AM, ID: 23386042Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 12:19 PM, ID: 23387341Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 12:20 PM, ID: 23387351Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/15/09 10:34 PM, ID: 23390640Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625