小网站,觉得可先从 core java/servelet/html/jsp/css 开始。以后如果觉得有需要
,复杂性没法管理,再研究上 framework。 这些东西都有 pros and cons, 确实需要
才用。
引用一个帖子中的抱怨,当然也有很多支持的。
“
Used to be we wrote simple, efficient, fast applications and web services
using just core Java, Servlets and JSP, html and xml, JDBC API. It was good
enough; JUnit was a good tool to test. We rested easy that our code worked.
Hibernate came along to simplify SQL and enable true mapping of Database
tables with Java objects, allowing hierarchical relationships to be
reflected in the Object Relations Mapping or ORM as we call it. I loved it.
Especially that we did not have to map the ResultSet back into a Java object
or data type.
Struts came along to add the Model View Controller pattern to our Web apps,
it was good.
EJBs were a huge overhead and pain and annotations made code look like
chicken scratch and now Spring got sprung on us innocent folks. It just
seems overdoing to me.
For example we now package our simple jdbc url, user, pass into jdbc.
properties first, then into hibernate properties second and then into Spring
beans third time!
Versus all that, consider getting a connection where you need it is really
as simple as shown below in pure java, which is what we really are doing
after going through all that hot air stuff with Spring:
Connection connection = DriverManager.getConnection(url, user, pass);
That is in itself self-explanatory that its a big round about and wrapping
round and round to do a simple thing fast and easy with no other big
benefits really. It's like wrapping tons and tons of gift paper around a
tiny nice gift which is all you really keep anyway.
Another example is a batch update. With Spring it is convoluted involving
quite a few classes, interfaces before you can use the JdbcTemplate to do a
batch update. With plain jdbc its simply:
Statement statement = connection.createStatement();
statement.addBatch(sqlquery);
statement.executeBatch();
Can't get simpler or faster than that.
I do not support this framework. Sorry. Who on earth wants injections every
time they need anything?”