jsp中定义函数要这样:
<%!
private String myfunction(String str)
{
...
}
%><%
String s = ...
String result = myfunction(s); //使用函数
%>
<%!
private String myfunction(String str)
{
...
}
%><%
String s = ...
String result = myfunction(s); //使用函数
%>
public String getStr(String str)
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String temp=new String(temp_t,"ISO8859_1");
return temp;
}
catch(Exception e)
{
}
return "null";
}
%>
private void myfunction(String str)这样才行,why???
org.apache.jasper.JasperException: Unable to compile class for JSPNo Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.