0

Hi All,

I am facing an issue with apostrophe.
Please look in to my code

String ss1="St: Mary's School.";
out.println("<input type='text' name='shipTest' value='"+ ss1 +"'>");

Output: St: Mary
Not able to display letters after the apostrophe. Kindly help me to resolve this issue.

Thanks in advance
--
Vinith

3
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by Manoj Phutela
0

Hi Henzard,

Thanks a lot for your reply.

I tried but its not coming properly. Then i tried replaceAll Method.

String s="St: Mary's School.";
String rp = "&nbsp;";
String s1=s.replaceAll(" ",rp);
out.println("<form action='replaceFunctionDisplay.jsp' method='post'>");
out.println("<input type='text' name='ship' value="+ s1 +">");
out.println("<input type='submit'>");
out.println("</form>");

Now i getting proper output inside my text box.
When i am paasing this text box value to another page i am getting the output with special characters instead of &nbsp;

<%
    String str = request.getParameter("ship");
    out.println("String : "+str);
    System.out.println("String : "+str);
%>

Out put : St: Mary's School.

Kindly help me

Edited by vinithktp: n/a

0

Try :

String s="St: Mary's School.";
String rp = "\'";
String s1=s.replaceAll("'",rp);
out.println("<form action='replaceFunctionDisplay.jsp' method='post'>");
out.println("<input type='text' name='ship' value="+ s1 +">");
out.println("<input type='submit'>");
out.println("</form>");

0

Hi Henzard,

Thanks for the quick response
Its look better.
Got this output inside the text box : St: Mary s School. //Apostrophe is not displaying
Got this output on next page: St: Mary s School. // Special character  displaying instead of apostrophe

Edited by vinithktp: n/a

0

Hi Henzard,

Thanks for the reply.
&apos; not working. I tried with

String rps = "&#39 ;";

Now its working fine. Getting both outputs correctly.

Thanks a lot for the help...

Edited by vinithktp: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.