cancel
Showing results for 
Search instead for 
Did you mean: 

Can we calling a class from a JSP generated in web forms??

sivaeiester
Champ in-the-making
Champ in-the-making
I have genetated a jsp from which i am calling a class. Where should i put the class file and how can i call it from my generated jsp????? :?:
1 REPLY 1

mrogers
Star Contributor
Star Contributor
The class needs to go onto the classpath of your application server.
There are a few ways to call a Java class from a JSP but the simplest is to add scriptlets to the JSP page which are java code contained within <%  %> characters.  e.g. <%= new java.util.Date() %>.
You can also define a bean with <jsp:useBean>.   A third way is to define a jsp tag.    And the fourth way is through some sort of action controler framework like jsf or struts.      Just google for "jsp basics" to get some more detail.