开发者

What is the preferable way to transfer the read & interpreted data from DB to the webpages

I am trying to build a social web application in Java using Database. I need to know what is the preferable way to transfer the read & interpreted data from DB to the webpages. I have created a DB abstraction layer which models my application. Should I use objects arrays to transfer the data between backend java class files and webpages?

Also any simple example application or explanation of how to build a web applicatio开发者_StackOverflown right from defining the DB layer to the GUI/View layer would be most appreciated!


Let a servlet or whatever controller class provided by your MVC framework, if any, obtain the data as a List<Entity> from the DAO class, make it available in the request scope and then forward the request to the JSP for display. In the JSP, any request scoped variables are accessible by EL ${}. You can use taglibs to iterate over it. In basic JSP, the JSTL <c:forEach> tag is perfectly suitable for this. Most MVC frameworks like JSF, Struts2, Spring MVC, etc also offers iteration tags.

Assuming that you're developing with plain vanilla JSP/Servlet, you may find the examples in the following answers useful: How to avoid Java code in JSP files? and Hidden features of JSP/Servlet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜