今天 做项目犯了两个错误,
第一,有enctype="multipart/form-data"属性的form表单。用response.getParameter("属性值")来获得属性,结果为null;
第二,response.sendRedirect("跳转的页面") 。这个response.sendRedirect在执行跳转的时候,居然是把后来的代码执行完了再跳转
<%
if(name == null){
response.sendRedirect("http://baidu.com"); //等后面的代码都执行完了再跳转
}
name.toString(); //跳转前会执行并抛出空指针异常
name.equals("hello world"); //跳转前会执行并抛出空指针异常
%>