This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Note: My question is about the special HTML character for a non-breaking space. When I type its code into the text composition window it looks fine, but when I "preview" the question, all that is seen is one blank space. Thus, I shall refer to this character as &+nbsp; to keep it from disappearing when I post.
Question: I need to insert a non-breaking space into an html table cell for it to display correctly (if the cell is left empty, there are no borders around it). Things work fine if the final html code for the cell looks like this: <td>&+nbsp;</td>
I'm using Tomcat and JSP pages to generate the HTML code with data for the cells taken from a PostgreSQL database table. The PostgreSQL data is inserted into a Java bean and utilized in the JSP page with JSTL tag:
If I store '&+nbsp' as text in the PostgreSQL table's column, it gets printed as literal text in the html table instead of being recognized as an html code. The final HTML source code looks like this: <td>&+amp;nbsp;</td> (without the "+" sign).
Somehow the "&" character is being converted to the special graphic character "&+amp;" which causes the literal printing of "&." How can I override this conversion when the HTML code is generated and have the content of my PostgreSQL field recognized as an html code?
Son of a gun! I never would have thought to check the documentation for There it is, a tag attribute called escapeXml which tells the tag whether to escape characters. I set it to false and everything works perfectly! Thank you very much!
P.S. How did you get the text for <cut> to appear in the forums without the smiley face?