hi,
you can put the html equivalent for the characters like
something like
StringBuffer result = new StringBuffer(arg.length());
char ch;
for(int i=0; i<arg.length(); i++){
ch = arg.charAt(i);
if(ch == '\'')
result.append("'");
else
if( ch == '"')
result.append(""");
else
if( ch == '<')
result.append("<");
else
if( ch == '>')
result.append(">");
else
if( ch == '&')
result.append("&");
else
result.append( ch );
}
return result.toString();
regards,
nagarajan.
On Wednesday 30 January 2002 11:30, you wrote:
> Ohh no!!
> It has introduced problems with single quotes now!!
> Any solution that will counteract both?
>
> ----- Original Message -----
> From: Vibha Jindal <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 30, 2002 3:10 PM
> Subject: Re: Quotes Problem
>
> > Wow!!
> > It worked!!
> > Thanx a tonne
> >
> > ----- Original Message -----
> > From: Sabari Arasu (CTC) <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, January 30, 2002 3:11 PM
> > Subject: Re: Quotes Problem
> >
> > > Try this....
> > >
> > > lArCommodity[<%= (i+1) %>] =
> > > new Array('<%= lComboData.ciId %>', '<%= lComboData.csName %>' );
> > >
> > >
> > > Sabari Arasu
> > > TCS Chennai.
> > >
> > > > -----Original Message-----
> > > > From: Vibha Jindal [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, January 30, 2002 2:52 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Quotes Problem
> > > >
> > > > Hi,
> > > >
> > > > I am encountering a problem.
> > > >
> > > > I am making an array using JAVAScript in a JSP.
> > > >
> > > > <!-- MAKE ARRAY OF COMMODITY VECTOR -->
> > > > <script language="Javascript">
> > > > <!--
> > > > lArCommodity = new Array( <%= (lvCommodity.size()+1) %>);
> > > >
> > > > lArCommodity[0] = new Array("", "");
> > > > <%
> > > > for (int i=0; i<lvCommodity.size(); i++)
> > > > {
> > > > ComboData lComboData = new ComboData();
> > > > lComboData = (ComboData)lvCommodity.elementAt(i);
> > > > %>
> > > > lArCommodity[<%= (i+1) %>] =
> > > > new Array( "<%= lComboData.ciId %>", "<%= lComboData.csName %>" );
> > > > <%
> > > > }
> > > > %>
> > > >
> > > > The problem I am encountering is, that the values of the array can
>
> have
>
> > > > quotes (") in them. This gives a javascript error.
> > > > e.g.,
> > > > The value of lComboData.csName is Plastic Components"s in the
>
> database
>
> > > > The javascript error is
> > > > missing ) after argument list.
> > > >
> > > > new Array( "20", "Plastic Components"s" );
> > > > .......................................^
> > > >
> > > > Can anyone help? I want it to retain teh double quotes between the
>
> two
>
> > S,
> >
> > > > because I am using this array to fill a Choice box and I want the
>
> value
>
> > in
> >
> > > > teh drop down to be visible as Plastic Components"s.
> > > >
> > > > function fillCommodityCombo()
> > > > {
> > > > lbExists = 0;
> > > > for(i=0; i<lArCommodity.length; i++)
> > > > {
> > > > document.write("<OPTION " );
> > > > if (lArCommodity[i][0] == "<%= lAuditScreenData.ciPrefixid %>")
> > > > {
> > > > document.write(" SELECTED ");
> > > > lbExists = i;
> > > > }
> > > > document.write(" >");
> > > > document.write(lArCommodity[i][1] + "</OPTION>");
> > > > }
> > > > document.frmProcessAuditInfo.txtPrefix.value =
> > > > lArCommodity[lbExists][0];
> > > > }
> > > >
> > > >
> > > > Regards,
> > > > Vibha
> >
> > =========================================================================
> >=
> >
> > > > =
> > > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > > JSP-INTEREST".
> > > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > > DIGEST".
> > > > Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > > http://archives.java.sun.com/jsp-interest.html
> > > > http://java.sun.com/products/jsp/faq.html
> > > > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > > http://www.jguru.com/faq/index.jsp
> > > > http://www.jspinsider.com
>
> ===========================================================================
>
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >
> > JSP-INTEREST".
> >
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> >
> > DIGEST".
> >
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > > http://archives.java.sun.com/jsp-interest.html
> > > http://java.sun.com/products/jsp/faq.html
> > > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > http://www.jguru.com/faq/index.jsp
> > > http://www.jspinsider.com
>
> ===========================================================================
>
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>
> JSP-INTEREST".
>
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>
> DIGEST".
>
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://archives.java.sun.com/jsp-interest.html
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > http://www.jguru.com/faq/index.jsp
> > http://www.jspinsider.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com