The JSP below shows how you could change the options displayed in a select based on the selection of a radio button.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<title>Struts – JavaScript Example</title>
<script language="JavaScript">
function getOptions(control) {
form = control.form;
form.action = "SetOptions.do?someProp=";
form.action += control.value;
form.submit();
}
</script>
</head>
<body>
<html:form action="ProcessMyForm">
<html:radio property="someProp1" value="val1"
onclick="getOptions(this);"/> Value 1<br/>
<html:radio property="language" value="val2"
onclick="getOptions(this);"/> Value 2<br/>
SomeProp2:
<html:select property="someProp2">
<html:optionsCollection property="prop2Values"/>
</html:select>
</p>
<html:submit/>
</html:form>
</body>
</html>
Jignesh Patel wrote:
Hi All, In our application when user selects country like USA or Canada in turn it has to show corresponding country's states.
Is there any struts example available for the same.
-Jignesh
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

