传值问题
页面部分代码:
<form action= "/manage/info.do?actionType=delete " method= "post ">
.
.
<% DBmanager db = new DBmanager();
String sql = "select * from info ";
ResultSet rs = db.doExcuteQuery(sql);
%>
<th height= "74 " > <%=rs.getInt( "infoId ")%> </th>
.
.
<% if (!rs.next()) {
break;
}
}
%>
action部分代码:
InfoForm info = (InfoForm) form;
int id = info.getInfoId();
System.out.println(id);
打印出来的id是0;
页面的infoId都可以正常显示,也可以找到对应的action的方法,但为什么传过来的值是0,而不是和页面对应的infoId啊???
------解决方案--------------------你的infoId在页面的什么地方定义的?
------解决方案--------------------查看一下你的FORM范围
------解决方案-------------------- <html:form action= "/manage/info.do?actionType=delete " method= "post ">
.
.
<% DBmanager db = new DBmanager();
String sql = "select * from info ";
ResultSet rs = db.doExcuteQuery(sql);
%>
<th height= "74 " > <html:text property= "ad " value= " <%=rs.getInt( "infoId ")%> " /> </th>
.
.
<%if (!rs.next()) {
break;
}
}
%>
------解决方案--------------------你还是把整个form部分都贴出来把
看不明白
------解决方案-------------------- <% DBmanager db = new DBmanager();
String sql = "select * from info ";
ResultSet rs = db.doExcuteQuery(sql);
%>
<th height= "74 " > <%=rs.getInt( "infoId ")%> </th> //我不明白你没有执行rs.next()你怎么可能取得值呢?
.
.
<%if (!rs.next()) {
break;
}
}
%>