Test development for JSP specifically for testing

I write test code even before I understand what TDD is. Calling functions and classes that do not have their own implementation help me understand and build my application much faster and more efficiently. Therefore, I very often use the process of writing code → compilation → seeing that it does not succeed → fixed it by building its implementation.

This process is a bit more complicated for the Internet. In particular, JSP. When I compile my Java classes, everything is fine, I see compilation errors. However, when I detect errors in the JSP, I need to open a browser and call this particular JSP.

Is there a way to avoid this process and show me JSP compilation without actually loading the browser?

+5
source share
3 answers

I usually do not test JSP directly. In general, it’s a good idea to keep as little logic as possible in your JSPs, and if you JSPs contain only a few tags <c:out>, then there really is not much to test. However, if you have enough logic inside them, then what I will do is extract that logic into a user tag that you can easily test.

+2
source

Of course. You can precompile JSP. Even the ant task is performed. See Link: http://ant.apache.org/manual/Tasks/jspc.html

, . . , , .. . , , Jakarta Cactus ( ), .

, Java.
+3

- , , AlexR .

JSP , - (), -, .

Cactus . Selenium.

. Spring, .

JSP - JSP , , JSP, .

JSP - , - JSP, , Wicket Tapestry , Velocity - Java JSP .

+1

All Articles