Can I create documentation for a JSP file using javadoc ?

John Zukowski

While there is nothing stopping you from including /** javadoc */ style comments in your JSP files, there really isn't a normal/natural way to generate them. What you would have to do is be sure your server saved the generated .java file, then run javadoc on that. However, as soon as you changed the JSP file, the .java file would change (including the class name), requiring another running of javadoc. Until you change the JSP file again....

This really leads to the question, why do you want to generate them? Normally, javadoc generated pages tend to be used to describe/document reusable libraries. If you are documenting reusable methods, do they belong in JSP files? Probably not. While you get the dynamic nature of JSP files, you don't know what class they are in and each change in the JSP file requires them to be recompiled. If you have what should be library code in there, you're increasing the overall compilation time.