Using JavaBeans in JSP

The JSP that we created previously does not follow JSP best practices. In general, it is a bad idea to have scriptlets (Java code) in JSP. In most large organizations, UI designer and programmer are different roles performed by different people. Therefore, it is recommended that JSP contains mostly markup tags so that it is easy for designers to work on the page design. Java code should be in separate classes. It also makes sense from a reusability point of view to move Java code out of JSP.

You can delegate the processing of the business logic to JavaBeans from JSP. JavaBeans are simple Java objects with attributes and getters and setters methods. The naming convention for getter/setter methods in JavaBeans is the ...

Get Java EE 8 Development with Eclipse now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.