Hello Daniel,

Just:

<%
  static private String generateJavascriptArr() {
     StringBuffer sb = new StringBuffer();
     sb.append("\"");
     for (int i=0; i < arrCity.size(); ++i) {
         sb.append((String)arrCity.get(i)); 
         if ((i + 1) < arrCity.size()) {
             sb.append("\", ");  
         } else {
             sb.append("\"");  
         }         
     }
     
     return sb.toString();      
  }
%>

<script language="javascript">
  var arrCity = new Array(<%=generateJavascriptArr()%>);
</script>

There you have it ;-)

HTH,
Best Regards,
Giovanni

> -----Original Message-----
> From: Daniel [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 11:40 AM
> To: [EMAIL PROTECTED]
> Subject: Javascript and JSP Question?
> 
> 
> Hi All,
> 
> I have a Srting array Object
> 
> String[] str  = a.getCity();  //returns an array of City
> 
> 
> I have a Javascript Code here
> <script language="javascript">
> var arrCity = new Array();
> 
> for(i=0; i<<%=str.length%>;i++)
> I want to put all the elements in the str array Object into arrCity
> Javascript array Object.(i.e.) arrCity[i] = ?
> 
> </Script>
> 
> 
> Is this possible? Or Is there any work around for this?
> 
> Regards
> Daniel.E
> 
> ==============================================================
> =============
> 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

Reply via email to