Oops this happened again.
I did some refactoring today when i moved code from one package to another and forgot to update JSP’s import statements. Unit tests passed with usual SUCCESS message, code compiled without errors or warnings, at run time however there was a big exception waiting for me.
Using Eclipse or IntelliJ IDEA, how do you handle the fact that refactoring changes done to Java code are not reflected in JSP? Is there something i can do to force this?
Well, if you followed best practices, you wouldn’t have any scriptlet code, and thus any import statement in your JSPs. You would still have to refactor the JSPs if you rename a getter used in JSP EL expressions (for example), but changes in class names would not have any impact.
I would integrate JSP compiling into your build process (at least on the continuous integration server) to detect such problems in JSPs. Here’s how to do it with Tomcat. And you could use Selenium or HtmlUnit integration tests to check that your JSPs are executed without problem.