Something like this should do it.

Please note - I am using the commons-lang StringUtils class.

private static String escapable[] = { "&", "\"", "<", ">", "'" } ;
private static String escaped[] = { "&amp;", "&quot;", "&lt;", "&gt;",
"&apos;" } ;

/**
* HTML encode &, ", <,>, '
* 
* @param inStr String to encode
* @return String encoded String
*/
public static String HTMLencode(String inStr){
for(int i=0;i<escapable.length;i++){
inStr = StringUtils.replace(inStr, escapable[i], escaped[i]);
}
return inStr;
}
/**
* HTML decode &, ", <,>, ' 
* 
* @param inStr String to decode
* @return String decoded string
*/
public static String HTMLdecode(String inStr){
for(int i=0;i<escaped.length;i++){
inStr = StringUtils.replace(inStr, escaped[i], escapable[i]);
}
return inStr;
}

- vineet

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vinodh
Valleri (RBIN/EEC2)
Sent: Thursday, June 26, 2003 4:03 AM
To: [EMAIL PROTECTED]
Subject: [displaytag-user] Need Help




Hello All, 
    I am using display tag in my project for displaying the 
information in the tables. i am facing one strange problem in 
displaying the data. 
The Problem is: 
  The Original data in the bean i am storing is "(10704) DMDLFK4.10
<Oertel Heiko (ESI1)> (03.08.2000)" 
but the display tag is showing as "(10704) DMDLFK4.10 (03.08.2000)"
eliminating the red coloured one. 
i think it is due to "<>" . So anybody please help me how to achive
this... 
i am using Struts frame work. 


Thanks & regards,
Vinodh Valleri
Robert Bosch India Limited
Dept. EEC / EEC2                 (     : +91(80)508-1460
No.123, Industrial Layout     Fax    : +91(80)571-1865
Hosur Road, Koramangala   *     : [EMAIL PROTECTED]
Bangalore 560 095, India                   



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to