The technology of Java EE for web application designed as layers .
you can use lower layer to give you more control on the application but with more work efforts and complexity .
or use higher level that is build up on the low layer to give you more easy work.
The basic layer of Java web applications is Servlet . JSP built up on servlet. Then there are rich framework build on JSP Like JSF then there are more rich framework build op on JSF like prime faces .
the role is : more high layer equals to more easy work with more build in features
less layer equals to more control on the application
You can go a very long way with just servlets and JDBC. Consider JSPs using JSTL as an added nicety.
But I'd bet that if your web site consists of more than a page or two delivering database content to the browser, you'll quickly discover why web frameworks are so numerous. Hard-wired page navigation, control logic, blurred layers, etc. will cause headaches as your site grows.
You'll find you have a lot of similar, repetitive, but slightly different code for each bit of new functionality. If you have to maintain a site and keep it going, eventually it's likely that you'll reach the conclusion that there are patterns ripe for capturing. Who knows? Maybe you'll decide as a result of your experience that you want to take a crack at solving the web framework problem, too.
Whatever you do, I think having distinct layers is key. Don't have servlets do all the work - they're for handling HTTP requests. Embed the work in service classes that your servlets can simply call. That way you can reuse that logic. Keep persistence code in its own layer and don't let it leak out into others. You can have reusable components that will survive your first efforts. If you decide to switch to a web framework you'll just snap these layers into place and off you go.
I wrote my first significant web site without any frameworks - just straight servlets, JSPs and JDBC. It gave me a better understanding of what was going on. I think it helps.
answer belong to duffymo
من قبل
MD. Shibly Forkani , Sr. Software Engineer , Field Nation LLC
U can do it using Servlet.
A servlet is a Java class. It's written like normal Java.
A Java Server Page (JSP) is a file that is often used in place of a servlet because it makes it easier to output data. A servlet is similar to PHP since you can mix output (like HTML) with Java without using lots out.println stuff like is necessary with a servlet. A JSP file is actually a servlet; when you add it to your server, it gets compiled into a Java file without you knowing about it.