This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Yes , this might be possible to encrypt your .class files , but the classloader that would be loading those files should again decrypt the codes.I do not feel that is very useful as you can always decompile the classloaders code to find as how the decrytion of the classes being done.
The code of JSP pages is never available to the user, as it resides on the server only (where it is presumably safe). Or are you talking about a scenario where the customer is provided with a complete deployable web app?