开发者

Is POJO Servlet ever considered?

开发者 https://www.devze.com 2023-01-11 22:54 出处:网络
POJO is the norm in Spring but also pervasive in the Java EE world. One non-POJO stronghold is Servlet. I\'m wondering if any open source ever appeals to change.

POJO is the norm in Spring but also pervasive in the Java EE world. One non-POJO stronghold is Servlet. I'm wondering if any open source ever appeals to change.

POJO examples:

class MyHttpServlet { @Inject void doGet (@HttpServletRequest Request request, @HttpServletResponse Response response) {..} }

class MyOtherServlet { @Inject void doOther (@OtherServletRequest Request request, @OtherServletResponse Response response) {..} }

class MyOneWayServlet { @Inject void 开发者_开发百科doOneWay (@OneWayServletRequest Request request) {..} }

.....

Maybe it's all about how to make POJO/SoC/loose-coupling pragmatically.

Spring's taking on EJB2.x is straight replacing it that later yields to EJB3.x, but on Servlet adding a MVC layer above (like other web frameworks doing theirs).

Orginally i was asking if someone envisioned the radical way on Servlet. The answers seem to me clearly none.


I understand that you're asking for POJO-flavored alternatives to Servlet, is this correct?

There are none. It's the core building stone of a Java EE webapplication. It provides a mandatory application programming interface to intercept on HTTP requests. There are however a lot of Java EE based MVC frameworks which abstracts the whole Servlet away so that you end up with basically a Javabean (or POJO as you call it) as model and a JSP/(X)HTML page as view. Examples of such are JSF, Spring MVC, Struts2, Wicket, etc.

There's no need to reinvent Servlet. It's a mature and solid building stone. Just abstract it away using a MVC framework if it disturbs you.


Take a look at the Spring-MVC Controllers: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-controller

If I understand correctly, this is what you are looking for

0

精彩评论

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

关注公众号