首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

用request接受的参数怎么转换类型

2012-02-08 
用request接受的参数如何转换类型?我用Stringidrequest.getParameter( id )接收表单传过来的值,我数据

用request接受的参数如何转换类型?
我用String   id=request.getParameter( "id ");接收表单传过来的值,我数据库里的id字段类型为INT的,如何转换呢?
因为我在JAVA文件里写的方法是:
public   void   update(ProductDetails   item)throws   Exception{
        String   sql= "update   test_procdcts   set   content= ' "+item.getContent()+ " '   where   id= "+item.getID()+ " ";

st.executeUpdate(sql);
}
我要的更新是content字段,它在数据库里的类型是varchar(250).
我在做后台里的新闻更新模块,这个更新问题老是还解决掉,很着急啊!

[解决办法]
String idStr = request.getParameter( "id ");
int id = Integer.parseInt(idStr);

热点排行