我有一個servlet,我想在其中比較請求參數。我用下面的代碼比較JSP中的請求參數
<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>
我不知道怎麼回事錯了,因爲這是比較字符串的正確方法。
在我的jsp中工作正常,在堆棧跟蹤中還有其他的東西嗎? –