社区
Web 开发
帖子详情
checkbox的取值问题
likktank11
2004-08-24 05:36:59
String[] checkvalue=request.getParameterValues("delete");
System.out.println(checkvalue[0]);
输出显示值没有取到
这句取值语句有什么问题吗?
...全文
261
10
打赏
收藏
checkbox的取值问题
String[] checkvalue=request.getParameterValues("delete"); System.out.println(checkvalue[0]); 输出显示值没有取到 这句取值语句有什么问题吗?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
10 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
likktank11
2004-08-25
打赏
举报
回复
问题解决了 原来上一个</form>结束在了循环的里面
谢谢各位~~~
hary90
2004-08-25
打赏
举报
回复
应该没有问题,你可以运行网页后在浏览器看看你的原代码,看是否与你设计相符?
likktank11
2004-08-25
打赏
举报
回复
<input type=checkbox name=delete value="<%=custID%>"></th>
我怀疑是不是这个value值定义有问题? 请高手赐教~~
likktank11
2004-08-25
打赏
举报
回复
<form name=delete action="/salesmanageWeb/DelCustServlet" method="Post" style="border-left-style: solid; border-left-width: 0; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
<tr align="left">
<th width="37" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<input type=checkbox name=delete value="<%=custID%>"></th>
我的input 在下面啊 是不是form的name和input的name不能重复?
这个我倒是疏忽没有注意
bluesky35
2004-08-25
打赏
举报
回复
你把delete定义成了form,当然取不到
likktank11
2004-08-25
打赏
举报
回复
这是网页的部分代码
<%
java.sql.Connection con = null;
java.sql.ResultSet rs = null;
com.db.database.DatabaseObject dbBean = new com.db.database.DatabaseObject();
int cu = 1;
String linkMan = "";
String custID = "";
String custName = "";
String Phone = "";
String Telecopy = "";
String Address = "";
String Color="#ffffff";
try{
dbBean.getConnection();
rs = dbBean.getResultSet("select custlinkman,custid,custname,custphone,custtelecopy,custadd from salescust where userid = "+ userId);
while(rs.next()){
if (cu % 2 == 0) { Color="#A0CFFE"; }
else { Color="#FFFFFF"; }
linkMan = rs.getString("CUSTLINKMAN");
custID = rs.getString("CUSTID");
custName = rs.getString("CUSTNAME");
Phone = rs.getString("CUSTPHONE");
Telecopy = rs.getString("CUSTTELECOPY");
Address = rs.getString("CUSTADD");
%>
</form>
<form name=delete action="/salesmanageWeb/DelCustServlet" method="Post" style="border-left-style: solid; border-left-width: 0; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
<tr align="left">
<th width="37" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<input type=checkbox name=delete value="<%=custID%>"></th>
<th width="86" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<p align="center"><a href="demand_cust2.jsp?id=<%=custID%>"><%=custID%></a></th>
<th width="174" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<%=custName%></th>
<th width="118" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<%=Phone%></th>
<th width="112" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<%=Telecopy%></th>
<th width="89" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<%=linkMan%></th>
<th width="206" style="color: black; font-size: 12px; font-weight: 400; background-color: <%=Color%>;" height="1">
<%=Address%></th>
</tr>
<%
cu++;
}
}
catch (Exception e){}
finally{
if (dbBean != null) {
dbBean.close();
}
}
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="774" height="55" id="AutoNumber4">
<tr>
<td width="774" height="55">
<p align="center">
<font face="宋体" style="font-size: 9pt; background-color:#FFFFFF"><input type="submit" value="删除" name="submit1"></font></td>
</tr>
</table>
</center>
</div>
</form>
</body>
<%@include file="bottom.jsp"%>
</html>
gln
2004-08-24
打赏
举报
回复
是不是你的网页里的input标签中的name属性名没有设定好吧
angelheart
2004-08-24
打赏
举报
回复
觉得你应该把网页代码给出来~~~你有没给checkbox定义value?
<input type="checkbox" name="delete" value="1">
tomuno
2004-08-24
打赏
举报
回复
<input type="checkbox" name="delete">
likktank11
2004-08-24
打赏
举报
回复
下面是我的整个SERVLET,高手看看有什么问题吗?小弟先谢了
package com.sales;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.io.*;
import java.sql.*;
import java.util.*;
import com.db.database.DatabaseObject;
public class DelCustServlet
extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) {
Connection con = null;
java.sql.ResultSet rs = null;
DatabaseObject dbBean = new DatabaseObject();
System.out.println("0");
try {
String[] checkvalue=request.getParameterValues("delete");
System.out.println(checkvalue[0]);
dbBean.getConnection();
dbBean.setAutoCommit(false);
for(int i=0;i< checkvalue.length;i++)
{
dbBean.getUpdateCount("delete from salescust where custid='" + checkvalue[i] + "'");
try {
dbBean.commit();
}
catch (Exception e) {
dbBean.rollback();
}
}
}
catch (Exception e) {
}
finally {
try {
if (dbBean != null) {
dbBean.close();
}
}
catch (Exception e) {}
}
}
}
php
checkbox
取值
详细说明
设我们有一个html页面,代码如下: 复制代码 代码如下: <FORM method=”post” action=”checkTest.php”> <INPUT name=”test[]” type=”
checkbox
” value=”1″ /> <INPUT type=”
checkbox
” name=”test[]” value=”2″ /> <INPUT type=”
checkbox
” name=”test[]” value=”3″ /> <INPUT type=”
checkbox
” name=”test[]” value=”4″ /> <INPUT type=”
checkbox
” nam
jQuery中的RadioButton,input,
CheckBox
取值
赋值实现代码
1、jquery 获取单选组radio$(“input[name=’name’]:checked”).val(); 2、jquery获取radiobutton的下一个值$(“input[name=’name’]:checked”).next().text()$(“input[name=’name’]:checked”).val() 3、jquery 获取input的值$(‘#id’).val() 4、jquery判断多选框
checkbox
$(“#id:
checkbox
”).attr(“checked”)
取值
$(“#id”).attr(“value”);赋值则是在text()、val()里面直
C#_winform_动态生成RadioButton和
CheckBox
并获取选中值
C#的winform是没有webform的RadioButtonList和
CheckBox
List这两个控件的。要实现从数据库取出数据后动态生成N个RadioButton和
CheckBox
并获取选中项目的值,请看本例。思路很简单,有
问题
请指出,相互学习共同进步,谢谢。
Html\
checkbox
)属性解析及应用.docx
Html\
checkbox
)属性解析及应用.docx
jquery获取input表单值的代码
jquery取radio单选按钮的值$(“input[name=’items’]:checked”).val();jquery radio
取值
,
checkbox
取值
,select
取值
,radio选中,
checkbox
选中,select选中,及其相关 获取一组radio被选中项的值 var item = $(‘input[name=items][checked]’).val(); 获取select被选中项的文本 var item = $(“select[name=items] option[selected]”).text(); select下拉框的第二个元素为当前选中值 $(‘#select_
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章