org.apache.jasper.JasperException:无法为JSP编译类。

时间:2014-03-27 02:09:10

标签: java jsp jstl

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 176 in the jsp file: /encrypted.jsp
gn cannot be resolved

173:     <input type="text" name="itt"  value=""  />
174:         </label><br><br><br><br>
175:            <label><b>Generated Key-</b>
176:             <input type="text" name="Gnkey" value="<%=gn%>"/>
177:         </label>
178:  </td>

gn变量用于存储函数

的输出
<%
String gn = generateKey(SelectedIndex, key, itt);
%>

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

将其放入pageContext

<%
  pageContext.setAttribute("gn", gn);
%>

然后像${gn}

一样访问它

更改

<%
String gn = generateKey(SelectedIndex, key, itt);
%>

<!%
String gn = generateKey(SelectedIndex, key, itt);
%>

另见