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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.