1. Put the class files in WEB-INF/classes/
2. Import the class as <%@page import="
3. Call that class as you would do in a normal java program
eg:
<%@page import="test.Hello"%>
<%
Hello heloo = new Hello();
String myName = heloo.SayName();
out.println("From scriptlet : "+ myName + "\n");
%>
Using a jar file in jsp
1. Put the jar file in lib folder.
2. Import the jar file as <%@page import="
3. Call the class as
eg:
<%@page import="jarTest.*"%>
<%
jartest.Main m = new jartest.Main();
String name = m.getName("Pinda");
out.println(name);
%>
No comments:
Post a Comment