<p>This is a design question and good practice question.  How do you structure your Java web development such that a lot of logic is not in the JSP file.  Should you use any of the JSP tags for if structures or loops.  I see a lot of code where the logic is hard to follow because of poorly designed JSP files.  And then when you want to output to a different format like a PDF or XML document, you can't do it because all the logic is in the JSP file.</p>

<p>Are there any tips or practices that you follow for Java Web development.</p>

<p>I am currently using a combination of Spring, Hibernate, Struts...and work with some Servlet code.</p>

<p>There are good practices associated with Java development.  Many of us that have worked a while know them.  What are some good practices for JSP development.</p>

The easiest way to avoid placing logic in JSPs is simply to perform all that logic
before
forwarding a request to a JSP. The only logic you should need to do in a JSP is some basic looping (e.g. for creating HTML table rows), evaluating conditional statements, and data formatting.
All of this can be done without using scriptlet code (Java code) in the JSPs by using JSP tag libraries and EL. The most important tag library is
JSTL
. The JSTL tag library provides most of the logic you should ever need to perform in a view, though you may occasionally also use niche 3rd party tag libraries like
displaytag
which can reduce the amount of JSP code you need to write for specific tasks.