msasikala
asked on
display quotation marks in a text field in jsp
Hi,
Iam getting data from data base and displaying it in a text field in jsp.but the data is getting truncated whenever a quotation mark (") is encountered.My code is
<input type="text" name="txt_Description" class="textBox100" value=<%=itemRec[2]%> >
suppose itemRec[2] = test"quot"only, this is displayed as test"quot" and the other part is getting truncated.can any one pls help me this is very urgent
Iam getting data from data base and displaying it in a text field in jsp.but the data is getting truncated whenever a quotation mark (") is encountered.My code is
<input type="text" name="txt_Description" class="textBox100" value=<%=itemRec[2]%> >
suppose itemRec[2] = test"quot"only, this is displayed as test"quot" and the other part is getting truncated.can any one pls help me this is very urgent
Sorry, missed the closing quote of my own there ;-)
value="<%= itemRec[2].replaceAll("\"" , """) %>"
value="<%= itemRec[2].replaceAll("\""
ASKER
Hi,
I tried this but I'm getting the following error
cannot resolve symbol
probably occurred due to an error in /GloboWorksDev/En/Purchase Order/Crea te/PRPOUpd ate.jsp line 789:
class="textBox100" value="<%= itemRec[2].replaceAll("\"" , """) %>" >
I think there is no replaceAll(string,string) in jsp for a string and if I'm trying with replace() it is giving error as
replace(char,char) in java.lang.String cannot be applied to (java.lang.String,java.lan g.String)
probably occurred due to an error in /GloboWorksDev/En/Purchase Order/Crea te/PRPOUpd ate.jsp line 789:
class="textBox100" value="<%= itemRec[2].replace("\"", """) %>" >
can u pls suggest the solution
I tried this but I'm getting the following error
cannot resolve symbol
probably occurred due to an error in /GloboWorksDev/En/Purchase
class="textBox100" value="<%= itemRec[2].replaceAll("\""
I think there is no replaceAll(string,string) in jsp for a string and if I'm trying with replace() it is giving error as
replace(char,char) in java.lang.String cannot be applied to (java.lang.String,java.lan
probably occurred due to an error in /GloboWorksDev/En/Purchase
class="textBox100" value="<%= itemRec[2].replace("\"", """) %>" >
can u pls suggest the solution
Are you using JDK1.4? If not, then we need a different solution ;-)
If you are confident that no apostrophe's will appear in the text, you could use:
value='<%= itemRec[2] %>'
If you are confident that no apostrophe's will appear in the text, you could use:
value='<%= itemRec[2] %>'
ASKER
I'm not using JDK1.4 ,I'm using JDK1.3.1 and there is quite a possibility that I may get apostrophe's also in the text
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Like the man says ;-)
ASKER
Hi,
this is working fine for all the charactrers except for apostrophe's .whenever an apostrophe is encountered it is displayed as '
Ex: de'm'o is displayed as de'm'o
how shld this be handled?
this is working fine for all the charactrers except for apostrophe's .whenever an apostrophe is encountered it is displayed as '
Ex: de'm'o is displayed as de'm'o
how shld this be handled?
That is strange!! If every other character is being converted properly, then this is also suppose to work.......
I will do some testing on my own box and will let you know.......
I will do some testing on my own box and will let you know.......
The same &apos happened to me.
Instead of using ', try using '
Instead of using ', try using '
1. ' is not recognised in IE
2. ' IS recognised but in UTF-8 pages converted straight back to single quote, messing up my javascript.
Any ideas?
2. ' IS recognised but in UTF-8 pages converted straight back to single quote, messing up my javascript.
Any ideas?
value="<%= itemRec[2].replaceAll("\""