Yes, but why in the world would you want to do this?
You can put a main method in a jsp just like you can put any other method. The purpose of it eludes me, however. Especially since scriptlets are bad practice.
A JSP is just a kind of servlet, you know. A servlet is a java class. You can put a main method in at will. There's just no point to it.
You could not use a main() method for any kind of testing because a JSP depends on executing in the servlet container environment with a request and response , etc etc objects created by that environment.
Testing outside the servlet environment can be very helpful but you need to write classes that don't depend on the container.