在jsp页面勾选复选框时执行Action里面的方法。 <input type="checkbox"/>就是在jsp页面点击复选框的时候跳转到Action里面进行操作。就类似于.net里当双击一个服务器控件产生事件一样! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 selected属性里面跳到action就行啊 $('#checkbox').click(function(){ $.ajax({ type:"post", url:"你的action", data:{'参数1':value}, dataType:"json", success:function(data){ alert(data);//返回的数据 } });}) 会Google,会ctrl + c、ctrl + v,会略微改动就行。 谢了!一定会给你分的。其实我还是想有什么办法不写ajax。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script> function test(){ objName= document.getElementsByName("checkboxList"); for (i=0; i<objName.length; i++){ if (objName[i].type=="checkbox" && objName[i].checked){ //这里调用用ajax方法 } } }</script></head><body><input type="checkbox" onclick="test()" id="chk1" name="checkboxList"/><input type="checkbox" onclick="test()" id="chk2" name="checkboxList"/><input type="checkbox" onclick="test()" id="chk3" name="checkboxList"/></body></html> 不用ajax的话,判断只要选中了就进行form表单提交 如果不用ajax,只实现简单的跳转,window.location.href='你的url'就可以了。。 如何获取android浏览器的语言 手动显示struts2 校验 无法显现 java 调用winrar命令 KingForm struts2中在mysql保存出现?号 高分求:一个访问多页面时间控制的问题 签约问题 有关内存溢出 (OutOfMemoryError) 的问题 java.lang.NullPointerException错误在那里! 请问在tomcat中使用Bean是否要配置web.xml这个文件啊? 使用JS提交form表单问题~~~~~~在线等 servlet配置
url:"你的action",
data:{'参数1':value},
dataType:"json",
success:function(data){
alert(data);//返回的数据
}
});})
谢了!一定会给你分的。其实我还是想有什么办法不写ajax。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
function test(){
objName= document.getElementsByName("checkboxList");
for (i=0; i<objName.length; i++){
if (objName[i].type=="checkbox" && objName[i].checked){
//这里调用用ajax方法
}
}
}
</script>
</head><body>
<input type="checkbox" onclick="test()" id="chk1" name="checkboxList"/>
<input type="checkbox" onclick="test()" id="chk2" name="checkboxList"/>
<input type="checkbox" onclick="test()" id="chk3" name="checkboxList"/>
</body>
</html>
不用ajax的话,判断只要选中了就进行form表单提交