Reputation: 761
I have a servlet and I want to run .java code through scriptlet. I have a simple class in Temp.java.
package pack;
import static java.lang.System.out;
public class Temp {
public static void main()
{out.println("trololo");
}
}
And I want to invoke main method via scriptlet in index.jsp
<body>
<%@ page import="pack.*" %>
<%
out.println("whatever");
Temp temp = new Temp();
temp.main();
%>
</body>
What I have to do to make main function work after invoking via scriptlet? Printing "whatever" works, but main function doesn't print anything.
Upvotes: 1
Views: 1175
Reputation: 240928
It will print on console, check logs
you imported
import java.lang.System.out;
which is standard output, so check your stdout log
Use JSTL instead
Upvotes: 1