Hi,
I write a
java class named myClass file and it has a method myMethod.
I want to call myMethod from
jsp. I believe, we can do it using two ways.
1. I use <jsp:useBean id="myC" class="com.myClass" scope="session" />
and
<%
myC.myMethod();
%>
2. Another way I can call the class is
<%@ page import="com.myClass">
<%
myClass myC=new myClass();
myC.myMethod();
%>
When I run my JSP using first point 1, it runs fine, where as if I use point 2 (above) it fails with stack trace : value is null.
Can someone tell what is the difference between two approaches, which is better (provided there is solution to fix approach 1) of the two.
Thanks
Anil