how to run jar file methods in jsp

2020-08-01 07:01发布

问题:

i am trying to run jar file methods in my jsp,i have properly set the build path for jar and saved that jar in WEB-INF/lib folder. when i m trying to run jsp i am getting this error

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

here is the code where i am calling the jar method.

<%
    GenericLog gl=new GenericLog();
    String uname = request.getParameter("uname");
    String pass = request.getParameter("password");
    gl.write(uname);//jar file method which i am calling
    gl.write(pass);
%>

please suggest any solution...

回答1:

Have you import GenericLog.class file in your jsp file? Like

<%@ page import="java.util.*" %>

In above, it is importing all class file under java.util in jsp page. See example



回答2:

Keep the jar files in the Web/Inf folder and check method name should be public.



标签: jsp jar