开发者

What is the best way to do this java web project? What are the usable technologies?

I am a newbie to the programming world. I have experiences of developing simple projects using JSP and servlets (css,jquery and little bit of ajax).

Anyway now I got web a project which has the main requirement of serial number tracking. All the serial numbers will be entered to the database at the moment items 开发者_C百科arrive to the store. After that items can be moved to various places. The client will update the current location for each item using the web application to be built. (This is the basic idea)

This is a very simple project I know. But I would like to use the opportunity to learn more java related techniques and technologies. Anyone can mention me a standard professional way to plan. I really need to learn and follow some professional developing practices. At least naming some technologies to refer would help.


Since you'll be using a relational database, you'll want to learn about JDBC.

You can do this entire project with serlvets, JSPs, JSTL, JDBC, Tomcat, HTML, CSS, and JavaScript. That's all you need.

Create a three tier architecture:

  1. A view layer with servlets and JSPs to handle the view
  2. POJO services using Java interfaces to implement use cases.
  3. POJO persistence using Java interfaces to handle all CRUD operations.


There is a lot of possible technology combinations. For example you could use:

  • Hibernate for DB access,
  • Spring for dependency injection
  • JSF + rich faces to do presentation layer

This are good technologies for simple web applications.


I'm using Struts2, the convention plugin for struts2, and MyBatis for ORM right now. I'm using jsps for the views, but depending on how ambitious you are, you might want to look at FreeMarker or Velocity for views instead of straight jsp. I personally don't like jsp views.

A lot depends on your reason for learning the framework. Struts2 makes structuring a project fairly easy. Along with the convention plugin, it makes mapping request urls to actions fairly easy. However, coming from Rails, I can tell you that I feel like I am writing a LOT of code to accomplish very little. In particular, MyBatis seems to be the weakest link in this stack. I have to generate the database table, write a model class, write a (fairly easy in MyBatis) xml file to map the database to the model, and then write a small interface that provides method signatures for the queries in the MyBatis file. This seems very redundant compared to something like Rails (Ruby), Pylons (python) or Play (Java/Scala). To be fair, some of the redundancy is avoidable if you are good about names, types, etc., but there's still a gap.

I have grown to like Actions-as-objects (the struts2 way) instead of individual methods on larger controller objects, but it does mean more boilerplate code in practice.


Hey thanks for all your replies. I finally decided to use struts with hibernate. For the next project I'll be using POJO. Once again thanks for all your help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜