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

c# - ItextSharp font color issue in ver 5.5.4+ -

jquery - Multiple issues with pushstate: history, loading, calling functions -

ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -