cancel
Showing results for 
Search instead for 
Did you mean: 

Calling external Java from JSP web module

Former Member
0 Kudos

Hi,

I have made a JSP web module. I have also made a java file. The code is below.

import java.util.*;

public class DateDemo{

public Date returnDate() {

Date d=new Date();

return d;

}

}

How do I call that external java method from my JSP page? Where do I put the java code? On the same folder as my JSP pages. Do I put a .class file or the .java file?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Create a object of that class so that you can import all those methods of that particular class including it's objects....

Eg:- Testclass01 obj1 = new Testclass01 ();

Former Member
0 Kudos

Hi shanakac,

The code example you gave me was for calling the method in my java. But do you know where I should put my java file? Is it on the web content folder (same folder as my JSPs)? Do I put the .java file or the .class file? Thanks