• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

  html code in PostgreSQL table

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thank you!
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the default behavior of <c:out>. Did you check its documentation to see if you could change that behavior?

P.S. To cause the text &nbsp; to appear in the forums, use the HTML entity for the ampersand character.
 
Jim Borland
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 <c:out> to appear in the forums without the smiley face?
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Click the "disable smilies" check box.
 
reply
    Bookmark Topic Watch Topic
  • New Topic