Modifying the Calendar Application by Adding JavaBeans

Our prime aim in this section will be to reduce the scriptlets and declarations in the JSPs—month.jsp and input.jsp. You may not be able to totally do away with scriptlets (for example, while iterating through a loop to generate the cells), but you can delegate a lot of tasks to classes.

Creating the MonthBean

You will need to create a JavaBean, MonthBean, that will offtake a lot of declarations and scriptlets within month.jsp. The aim of this exercise is to provide the JSP with information that can easily be consumed by using simple expressions instead of scriptlets.

Table 4.2 shows the list of properties in MonthBean.

Table 4.2. MonthBean's Properties
Property Name Type Description ...

Get Java Server Pages from scratch now with O’Reilly online learning.

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