Given below is the
JSP code
<TD><SELECT name="dropdown" onchange="put()" size="3" >
<%if ( resultset != null ) {
while ( resultset.next() ) {
m_id = resultset.getString("CURR_EVENT_ID");
m_startDate = resultset.getDate("CURR_EVENT_START_TIMESTAMP");
m_endDate = resultset.getDate("CURR_EVENT_END_TIMESTAMP");
m_title = resultset.getString("CURR_EVENT_TITLE");
m_desc = resultset.getString("CURR_EVENT_DESCRIPTION");
m_flag = resultset.getString("CURR_EVENT_FLAG");
m_featured = resultset.getString("CURR_EVENT_FEATURED");
// taking "|" as a separator
str = m_startDate+"|"+m_endDate+"|"+m_title+"|"+m_desc+"|"+m_flag+"|"+m_featured+"|";
%>
<option value = "<%= str %>" > <%= m_id %>
<%
}
resultset.close();
resultset = null;
}
%>
</SELECT></TD>
The problem is the contents of title contains <B> , </B> , <A> , <P>
Now when I try to display these in the list box
there are unpredictable results since the
angular tags like '<' ans '>' is being taken as end of the tag itself for eg <input type="text" value="<B>Hello World</B>" > , How do I escape the html tags while I display them in the list box ?
For your reference, I am giving below the contents of m_title and m_desc
SQL rjanapareddy@MJSTRND> SELECT CURR_EVENT_TITLE FROM MJST_CURRENT_EVENTS WHERE CURR_EVENT_ID='2';
CURR_EVENT_TITLE
--------------------------------------------------------------------------------
<B>RADIO:</B><BR><a target="_blank" href="http://majestic.ea.com/home/view.jsp?l
ink=http://www.coasttocoastam.com">Coast to Coast A.M.</A>, hosted by Mike Siege
l
SQL rjanapareddy@MJSTRND> SELECT CURR_EVENT_DESCRIPTION FROM MJST_CURRENT_EVENTS WHERE CURR_EVENT_ID='2';
CURR_EVENT_DESCRIPTION
--------------------------------------------------------------------------------
10:00 PM-2:00 AM Pacific.<P> Guest: Scott Corales. Corrales is the Editor of INE
XPLICATA, and Director of Institute of Hispanic Ufology. The Institute was organ
ized in 1999 to serve as a clearinghouse for UFO and paranormal information orig
inating from Central America, the Caribbean, South America and Spain.