Struts问题,关于下拉列表的 onchange 事件的用法。 看怎么触发了,我也不懂,关注...."STRUTS的<html:form>没有name属性",这个怀疑,因为<form ...></form>是有name属性的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以用document.all.下拉列表名字这样能够取得你要的,其实如果使用OnChange也能实现你要的功能只要在Onchange中添加提交事件就行了,这样就会转到你的Action中执行了。 它有NAME的,是你的页面所对应的ACTIONFORM的名字可以试试OnChange事件 我是这么写的,但还是出错,ActionForm是employeeForm,Action是insertEmployee,请问应该怎么改才行?<html><head><script>function changeRadio(SID){ document.location="?schooluuid="+SID+"&year="+document.all.employeeForm.value;}</script></head><body><html:form action="insertEmployee" focus="name"> <html:select name="employeeForm" property="department" onchange='changeRadio("2815");'> <html:options collection="departments" property="id" labelProperty="description"/> </html:select><html:submit><bean:message key="button.submit"/></html:submit></html:form></body></html> 用struts框架的,form表单是不用写名称的,而是在config文件中配置Action的时候就绑定了。比如配置中 <form-beans> <form-bean name="LogonForm" type="com.test.LogonForm"/> </form-beans> <action-mappings> <action name="LogonForm" type="com.test.LogonAction" input="/logon.jsp" scope="request" path="/logon"> <forward name="success" path="/index.jsp" /> <forward name="error" path="/logon.jsp" /> </action> <action-mappings>这里的name,就是form表单的name,在logon.jsp页面中<html><head><script>function changeRadio(SID){ alert(document.LogonForm.department.value);//这里的form名称就是LogonForm}</script></head><body><html:form action="logon.do" focus="name"> <html:select property="department" onchange='changeRadio("2815");'> <html:options collection="departments" property="id" labelProperty="description"/> </html:select><html:submit><bean:message key="button.submit"/></html:submit></html:form></body></html> 多谢 feng_sundy(晓风) ,问题已解决! 求解:关于JSTL的forEach嵌套循环之index不为零的问题,望高人指点 求助 !!!!!!!!!!! el表达式中如何获得list的大小? ajax调用action中的方法 请教个思路 关于js解析xml的问题 eclipse怎么查看jsp生成的class文件 请教高手:Myeclipse 能创建*.hbm.xml文件吗? 怎么用一个Action传参实现添,删,改,查四种? j2ee同遗留系统(C和Tuxedo)的集成 JDBC+MYSQL 事务处理问题 急! 在jb9里添加xerces2.6.2的引用,org.apache.xerces.parsers.DOMParser就没有了?
这样能够取得你要的,其实如果使用OnChange也能实现你要的功能
只要在Onchange中添加提交事件就行了,这样就会转到你的Action中执行了。
可以试试OnChange事件
<html>
<head>
<script>
function changeRadio(SID)
{
document.location="?schooluuid="+SID+"&year="+document.all.employeeForm.value;
}
</script>
</head>
<body>
<html:form action="insertEmployee" focus="name">
<html:select name="employeeForm" property="department" onchange='changeRadio("2815");'>
<html:options collection="departments" property="id" labelProperty="description"/>
</html:select><html:submit><bean:message key="button.submit"/></html:submit>
</html:form>
</body>
</html>
比如配置中
<form-beans>
<form-bean name="LogonForm" type="com.test.LogonForm"/>
</form-beans>
<action-mappings>
<action name="LogonForm"
type="com.test.LogonAction"
input="/logon.jsp"
scope="request"
path="/logon">
<forward name="success" path="/index.jsp" />
<forward name="error" path="/logon.jsp" />
</action>
<action-mappings>这里的name,就是form表单的name,
在logon.jsp页面中<html>
<head>
<script>
function changeRadio(SID)
{
alert(document.LogonForm.department.value);//这里的form名称就是LogonForm
}
</script>
</head>
<body>
<html:form action="logon.do" focus="name">
<html:select property="department" onchange='changeRadio("2815");'>
<html:options collection="departments" property="id" labelProperty="description"/>
</html:select><html:submit><bean:message key="button.submit"/></html:submit>
</html:form>
</body>
</html>