Is there a way to call Java class with main() from JSP and print the value in the console or JSP page -


i have doubt:

  1. is possible call java class main() in jsp , print value in console or jsp page (without use of servlet class)?

  2. similarly print value in jsp page java class main() (without use of servlet class)?

please need explanation.

since typical main() method has return type void, cannot done:

public staic void main(string[] args) { ... } 

but call static method on class , return string , output jsp:

class

public class util {   public static string dosomething() {     // , generate string     return "helloword";   } } 

jsp:

<%= util.dosomething() %> 

this prints out return value of static dosomething() method @ jsp output tag included.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -