I don't know exactly why you want to do that ? Why don't you use <% Hashtable states = new Hashtable(); states = Combo.getStates(country); .... %> and then you use Country: <%=country.toString()%>
You don't need to use this javascript stuff, cause the disadvantage is that you execute this document.write stuff on the client side. You first execute you java scriptlet, the transfer the date to the client and there the javascript code is executed. So it would be easier if you would only work with Java scriptlets or Tags here Oliver -----Original Message----- From: sanjeev_dutt [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 2:32 PM To: Struts Users Mailing List Subject: Passing JavaScript variable to a Java Scriptlet on a JSP page Hi, I have this piece of code on my JSP: <Script language = "javascript"> function fnGetStates() { country = document.searchAcctForm.cboAcctAddrCountry.value; alert(country); document.write('<% Hashtable states = new Hashtable(); %>'); document.write('<% states = Combo.getStates(country);%>'); document.write('<% Enumeration state = states.keys(); %>'); document.write('<% while (state.hasMoreElements()) { %>'); document.write('<% String statecode = (String)state.nextElement(); %>'); document.write('<% String sts = (String)states.get(statecode); %>'); document.write('<html:option value="<%= statecode %>"><%= sts %></html:option>'); document.write('<% } %>'); } </Script> The problem is that "alert" is able to show the value of country. But within the document.write, It is not able to get the value of "country". It throws the following error : ~:\citione\web\WEB-INF\_tmp_war_myserver_myserver_web\jsp_servlet\_jsp\_sear ch\__searchacct.java:801: cannot resolve symbol probably occurred due to an error in /jsp/search/searchacct.jsp line 197: document.write('<% states = Combo.getStates(country);%>'); Could some one help ? Thanks Sanjeev -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>