请大家帮我看看 我这个查询哪里不对 我对数据结构也不是很清楚 数据上出错了 运行时显示“将截断字符串或二进制数据”java.lang.ClassCastException
首先我在一个页面中提交了查询表单
<html:form action="/registredeemAction.do">
<center>
<table border="0">
<tr>
<td>请输入需补办暂住证人身份证号:</td>
<td><html:text property="idcard" /></td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit value="查询"/><html:reset value="重添"></html:reset></td>
</tr>
</table>
</center>
</html:form>
然后在action
try{
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from T_A01 where idcard = "+"'"+idcard+"'";
rs=stmt.executeQuery(sql);
if(rs.next())
{
redeemDatabase.addElement(rs.getString("idcard"));
redeemDatabase.addElement(rs.getString("name"));
redeemDatabase.addElement(rs.getString("sex"));
redeemDatabase.addElement(rs.getString("folk"));
redeemDatabase.addElement(rs.getString("birthyear"));
redeemDatabase.addElement(rs.getString("birthmonth"));
redeemDatabase.addElement(rs.getString("birthday"));
redeemDatabase.addElement(rs.getString("marriage"));
redeemDatabase.addElement(rs.getString("occupation"));
redeemDatabase.addElement(rs.getString("relativephone"));
redeemDatabase.addElement(rs.getString("privence"));
redeemDatabase.addElement(rs.getString("resume"));
ok=true;
return(mapping.findForward("successredeem"));
}
(估计就是这里错了)
显示用自定义标签
try
{
Vector redeemVector=(Vector)session.getAttribute("redeemDatabase");
out.println("<table border=\"2\" cellspacing=\"0\" cellpadding=\"0\">");
out.println("<tr>");
out.println("<th BGCOLOR=\"#00FF00\"><b>身份证</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>姓名<b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>性别</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>民族</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>出生日期</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>婚姻状况</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>职业</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>亲属联系方式</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>来自省份</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>简历</b></th>");
out.println("</tr>");
for(int i=0;i<redeemVector.size();i++)
{
redeemVector.elementAt(i);
out.println("<tr>");
out.println("<td>"+ redeemVector.get(0) + "</td>");
out.println("<td>"+ redeemVector.get(1) + "</td>");
out.println("<td>"+ redeemVector.get(2) + "</td>");
out.println("<td>"+ redeemVector.get(3) + "</td>");
out.println("<td>"+ redeemVector.get(4)+"-"+ redeemVector.get(5)+"-"+redeemVector.get(6)+ "</td>");
out.println("<td>"+ redeemVector.get(7) + "</td>");
out.println("<td>"+ redeemVector.get(8) + "</td>");
out.println("<td>"+ redeemVector.get(9) + "</td>");
out.println("<td>" +redeemVector.get(10) + "</td>");
out.println("<td>"+redeemVector.get(11)+"</td></tr>");
}
out.println("</table>");
}catch (Exception ex)
{
throw new JspTagException("IOException:" + ex.toString());
}
请问是哪里错了呢???有什么好方法可以更简单的实现数据查询后显示的呢???程序配置没有问题 就是查询或者输出数据库出错。请高手指教 再线等,等不到我不走了啊