Hi Oliver,

The main issue here is that I don't want to reload the page.
Is there some way this could be done without reloading the page ?

Thanks
Sanjeev

-----Original Message-----
From: Oliver Reflé [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 6:26 PM
To: Struts Users Mailing List
Subject: RE: Passing JavaScript variable to a Java Scriptlet on a JSP
page


Why don't you try it like this,
your Option list could be derived from a collection which is stored as an
attribute of the page.
Each time you select a value you can call a javascript funtion which filters
this collection.

Maybe your data is stored like that
germany.bavaria.nuremberg
englang.blabla.london

so you can filter the data, then reload the the page(don't forget to
set again your collection as attribute)

-----Original Message-----
From: sanjeev_dutt [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 2:49 PM
To: Struts Users Mailing List
Subject: RE: Passing JavaScript variable to a Java Scriptlet on a JSP
page


Hi Oliver,

I am forced to do that. Actually on my JSP I have three lookups: Country,
State and City.
If the user choses a particular country, then he should be able to see only
the corresponding states in the states lookup.
This is where the JavaScript comes in.

Any other suggestions to implement this ?

Thanks
Sanjeev



-----Original Message-----
From: Oliver Reflé [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 6:10 PM
To: Struts Users Mailing List
Subject: RE: Passing JavaScript variable to a Java Scriptlet on a JSP
page


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]>


--
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]>


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

Reply via email to