I am writing a simple blog application. Each entry has a title and a body.
The body may contain html elements such as "<p>". However, if you add the
following value into your sample data, the html elements are cut off and
hence not inserted into the database:

  <value> <p> London is a great city. </p></value>

The solution is to xml-escape the html elements:

  <value> &amp;lt;p&amp;gt; London is a great city.
&amp;lt;/p&amp;gt;</value>

If you look into your database, then you'll see that the value 

  <p> London is a great city. </p>

was inserted. Hope that helps other newbies like me. I searched for some
hints in the forum, but could not find.

By the way, if you use Struts2 and if you want to output the html snippet
with formatting, then you have to disable escaping. In my case it looks like
this: 

  <s:property escape="false" value="body"/>

Cheers.
-- 
View this message in context: 
http://www.nabble.com/How-to-add-html-values-in-sample-data-tp16824092s2369p16824092.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to