开发者

MVC servlets JSP javabeans- how many javabean classes should i have?

hey there! this is just a general enquiry.. so far, i have one servlet which sends dispatches actions around, many JSP files.. but my question is- how many javabeans files does a typical web application like flickr have? so far, i have only 1- but it has a lotta get and set methods. is this o开发者_如何学JAVAkay?


First of all, not every web application is written in Java, and although Flick might be written partially, it's not using it entirely.

Next, your question about usage of JavaBeans is definitely very general. One bean should exist for each "entity" in your application, and what an entity is, your application defines.

Also, this number varies based on what technology you're using. Some frameworks require you to use beans for many things (JSF), while others do not.

So, before asking for number of beans for existing project, you should determine what your project actually uses and, depending on it's size, it will have more or less beans.

I suggest you don't invent the wheel. If you want to use MVC in Java, I'd suggest using Spring MVC since it's a very good MVC framework in my opinion.

Research before making assumptions. Amount of X, for X being something like line count, file count, or some other arbitrary thing, does not make a sucessful application.


Since your project is pretty simplistic using servlets, you can start with one bean, and then break it into several as the complexity grows. It's a good idea to have related functionality grouped together, instead of a single, massive collection of code ;o)

I'm sure large websites are complex and have TONS of beans. JSF is used often, so you'd have managed beans, and probably stateless or stateful EJB's also. In those kind of projects, servlets are used for more specialized tasks, such as playing audio or allowing users to download binaries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜