I am using a servlet to call a jsp file (I am not using any beans). When I place a user-defined class in the code fragment section <% %> of the JSP file, it always throws me a JspException stating: Undefined variable or class name: <User-Defined class>. Am I doing something incorrect here? How come it cannot locate the user-defined class even though it is there?
 
Any solution/suggestion would be much appreciated.
 
Thanks 
This is because the code that you enter inside the <% %> is actually put inside a function (normally "service") which a member of a servlet class. Declaring a class inside a function is not legal Java, hence the error. You should define your class in a separate Java file and import it.
 
Hope this helps,
 
John Wheeler.

Reply via email to