我开发ecomerce网站,因为用户可以在主页上显示所有产品显示的类别明智产品然后点击图像然后查询字符串传递和显示的细节但是当在同一描述中想要数据按类别过滤时则会出现以下错误java.lang.NumberFormatException:null
Product Bean
public String singledispp(int pid)
{
ProductTbl p=ad.searchproduct(pid);
product_id=p.getProductId();
return "/client/single.xhtml?faces-redirect=true&product_id="+product_id;
}
public String dispbycat(int cid)
{
CategoryTbl ct=(CategoryTbl)ad.searchcat(cid);
category_id=ct.getCategoryId();
return "/client/products.xhtml?faces-redirect=true&categoryId="+category_id;
}
public Collection<ProductTbl> getproductbyid()
{
Map<String,String> params =FacesContext.getCurrentInstance().
getExternalContext().getRequestParameterMap();
String parameterOne = params.get("product_id");
int foo = Integer.parseInt(parameterOne);
return ad.getAllProductByProductid(foo);
}
public Collection<ProductTbl>getbycat()
{
Map<String,String> params =FacesContext.getCurrentInstance().
getExternalContext().getRequestParameterMap();
String parameterOne = params.get("categoryId");
int foo = Integer.valueOf(parameterOne);
dispbycat(foo);
return ad.getbycategoryid(foo);
}