Skip to main content

Posts

Showing posts from July, 2010

Display special character

I have problem when user key in single quote or double quote in textfield and view it in textfield. I am using jsp where by I put the code like this user input >> display output >> It saved successfully in Oracle database , but problem happen when it want to display in input field. Then I change my code into Yes, it save a day but only for awhile because the user might be key in input such user input >> display output >> See, it cannot read the double quote because it stop at double quote. At last this morning, I found out the solution. public String convSpecialChar ( String htmlString ) { htmlString = htmlString . replaceAll ( "\\<.*?\\>" , "" ); htmlString = htmlString . replaceAll ( "\r" , " " ); htmlString = htmlString . replaceAll ( "\n" , " " ); htmlString = htmlString . replaceAll ( "\"" ,