Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

JSP Best Practices

Jtalbot
Employee
Employee

As discussed in many seminars, using Sightly can make a project go better because it can provide a better separation between business logic and UI code, as well as allow traditional HTML/JS developers to help out on a project in an easier fashion.


However, in some cases you must use JSPs for a project. Let's talk about some best practices for JSP development:

1). Use tag libraries (JSTLs) as much as possible.  Create tag libraries before a project. Try not to use scriptlets i.e. <% in your JSP code. A good guideline to follow is no more than 30 lines of code in a JSP.

2). Do not use the Geometrixx sites as a guideline for JSP development. These sites look great but were not designed with coding best practices for a project.

3). Be sure business logic is in an OSGI bundle NOT inside of the JSP.

4). Establish a clear naming structure

5). Be sure each application has its own global.jsp which of course should include the default global JSP script that ships with AEM.

6). Extend, extend, extend. Be sure to throughly check everything that ships with AEM and reutilize this functionality where you need it.

7. Establish a clear naming system for everything including variables etc that all developers agree on.

0 Replies