我有一个 servlet,我想在其中比较请求参数。我正在使用以下代码
<body>
<%
if(request.getParameter("type")!=null)
{
if(request.getParameter("type").equals("recover"))
{
%>
<h1>Recover</h1>
<%
}
}
else if(request.getParameter("type")!=null)
{
if(request.getParameter("type").equals("reset"))
{
%>
<h1>Reset</h1>
<%
}
}
%>
</body>
但是这个jsp给出了一个编译时异常堆栈跟踪如下
org.apache.jasper.JasperException: An exception occurred processing JSP page /recover.jsp at line 16
</head>
<body>
<%
if(request.getParameter("type").equals("recover")) <--- line16
{
%>
<h1>Recover</h1>
我不知道出了什么问题,因为这是比较字符串的正确方法。