What's the point of beans?

后端 未结 6 1728
故里飘歌
故里飘歌 2020-12-20 11:36

I\'ve bean doing some JSP tutorials and I don\'t understand what the point of a bean class is. All it is, is get and set methods. why do we use them?

public          


        
6条回答
  •  醉话见心
    2020-12-20 12:06

    You can have JSP without beans, however, the result will be that both the code taking care of the logic and the code taking care of the aesthetics of the site will be jumbled up. This is not ideal especially since in most situations, a group of people codes the logic and another group of people take care of the aesthetics, so beans allow a degree of separation which makes life easier for the people building the website.

    Beans also allow you to reuse the code, which is another reason why you should use them.

提交回复
热议问题