数据库里的id是INT型的。
报错是;
The method setID(String) in the type ProductDetails is not applicable for the arguments (int)
14: //out.print(id);
15: ProductDetails item1=new ProductDetails();
16: item1.setContent(content);
17: item1.setID(id);
18: item1.setTitle(title);ProductDetails文件就是:
int id;
public int getID(){
return id;
}
public void setID(int id){
this.id=id;
}
编译过了。
怎么回事呢?
报错是;
The method setID(String) in the type ProductDetails is not applicable for the arguments (int)
14: //out.print(id);
15: ProductDetails item1=new ProductDetails();
16: item1.setContent(content);
17: item1.setID(id);
18: item1.setTitle(title);ProductDetails文件就是:
int id;
public int getID(){
return id;
}
public void setID(int id){
this.id=id;
}
编译过了。
怎么回事呢?
解决方案 »
- Date
- properties文件中\u7de8\u96c6用的是Unicode编码么?
- 关于jsp中上传图片的问题?
- 初学jsp 用include传递参数时中文乱码
- dwr提示变量未定义?谢谢大家。
- 怎么画流程图
- 100分求助,struts上传文件的NoSuchMethodError
- 请大家诊断一段联动程序,数据多而无法显示
- 分割字符串并返回所要得值原先用vbscript 写的有高手能翻译一下吗
- 关于jasperreport例子的编译使用??就30分了,棒棒忙吧!csdn都是活雷锋!!!
- 菜鸟急问,请问JavaScript如何实现二维数组。
- Connection的自动提交是怎么一回事?(分比较少 见谅)
你这里的id类型不是INT
String idStr = request.getParameter("id");
int id = Integer.parseInt(idStr);
改为: item1.setID(Integer.parseInt(id));
public void update(ProductDetails item)throws Exception{
String sql="update test_procdcts set content='"+item.getContent()+"' where id='+item.getID()+'";
st.executeUpdate(sql);
}
public void update(ProductDetails item)throws Exception{
String sql="update test_procdcts set content='"+item.getContent()+"' where id="+item.getID()+"";
System.out.print("sql"+sql);
st.executeUpdate(sql);
}
没有结果,空页面!?
你有MSN吗?我们在那交流可以吗?可能以后还有很多问题要向你请教。
我的是[email protected]
刚才我在String sql="update test_procdcts set content='"+item.getContent()+"' where id="+item.getID()+"";的上面也加了System.out.println("kfjkdj");
可以还是没有输出啊?
item1.setContent(content);
item1.setID(Integer.parseInt(idStr));
item1.setTitle(title);
try{
NewsProductBean bean1=new NewsProductBean();
out.print(item1.getID);
这个out.print(item1.getID);报错了,应该是item1没有值吧?
报错是:
An error occurred at line: 25 in the jsp file: /addpro.jsp
item1.getID cannot be resolved or is not a field
22:
23: try{
24: NewsProductBean bean1=new NewsProductBean();
25: out.print(item1.getID);
那到这都可以执行了
try{
NewsProductBean bean1=new NewsProductBean();
out.print(item1.getID());
bean1.update(item1);是NewsProductBean类有问题吗?