request.getParameter("name")取不到值就会报空指针异常么?
后台代码
String category = request.getParameter("category");
if(category==null){
category="";
}
jsp代码
<a
href="${pageContext.request.contextPath}/showProductByPage?category=考试">考试</a>
<a
href="${pageContext.request.contextPath}/showProductByPage?category=生活百科">生活百科</a>
<a href="${pageContext.request.contextPath}/showProductByPage"
style="color:#FFFF00">全部商品目录</a>
如果前台不传值过来就会报空指针异常...怎么解决.,