tag:blogger.com,1999:blog-4498889353428710313.post3317879704165452372..comments2024-03-13T14:22:32.519-07:00Comments on Arjan Tijms' Weblog: JSF and MVC 1.0, a comparison in codeArjan Tijmshttp://www.blogger.com/profile/08548593340781885396noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-4498889353428710313.post-89702760255088472582015-01-23T15:38:51.116-08:002015-01-23T15:38:51.116-08:00Sounds like a comment from someone who is not good...Sounds like a comment from someone who is not good with JSF. I will develop quickly with the amazing Primefaces while you can stick to your granual mvc to build out your ui in 2 years.Anonymoushttps://www.blogger.com/profile/08511015875879378705noreply@blogger.comtag:blogger.com,1999:blog-4498889353428710313.post-62789474123871644532014-12-30T14:13:26.492-08:002014-12-30T14:13:26.492-08:00I kind of see Spring MVC as following the identica...I kind of see Spring MVC as following the identical pattern as Servlet MVC. The spring servlet just forwards control to the Spring Controllers, which may have many request mappings, which unfortunately leads to large controller classes doing much more than they should. <br /><br />However just having many Servlets, each servlet handling a single request mapping, leads to in my opinion, a much cleaner application with simpler Servlet based Controllers. JEE CDI dependency injection can be used in this environment. The two things missing are the automatic mapping between request parameters and variables, and handling of path parameters.<br /><br />Do we *really* need automatic mapping?<br /><br />@requestMapping("/doit")<br />public String doIt(@RequestParam(value = "memberId", required = false) Integer memberId){<br /><br />}<br /><br />is not that much easier than:<br /><br />public void doGet(HttpServletRequest arg0, HttpServletResponse arg1){<br />Integer memberId = arg0.getParameter("memberId")==null? <br />null:Integer.valueOf(arg0.getParameter("memberId"));<br />}<br /><br />And, adding a few utility methods can hide this 'hair', without resorting to a framework to do this.<br /><br />So.... Really, all that I would want for MVC 1.0, would just be adding of path parameter support to servlet mappings. So, there might be<br /><br />@WebServlet("/customers/{customerId}/address")<br /><br />and an additional getPathParameter() method added to httpServletRequest.<br /><br />Is this too much to ask without adding a framework that mimics Spring MVC, along with its disadvantages ?Tony Westonhttps://www.blogger.com/profile/01643488108450295587noreply@blogger.comtag:blogger.com,1999:blog-4498889353428710313.post-2306228053352109442014-12-30T14:00:13.223-08:002014-12-30T14:00:13.223-08:00This comment has been removed by the author.Tony Westonhttps://www.blogger.com/profile/01643488108450295587noreply@blogger.comtag:blogger.com,1999:blog-4498889353428710313.post-66840480192183995352014-11-27T18:14:16.369-08:002014-11-27T18:14:16.369-08:00One single big problem with JSF is unstable JSF co...One single big problem with JSF is unstable JSF component libraries such as Primefaces, which damage the image of JSF.Anonymoushttps://www.blogger.com/profile/07425669698514163367noreply@blogger.comtag:blogger.com,1999:blog-4498889353428710313.post-22291053791362655432014-11-26T06:40:02.546-08:002014-11-26T06:40:02.546-08:00> JSF is not a pure MVC framework because it ha...> <i>JSF is not a pure MVC framework because it has view and controller mixed together.</i><br /><br />Well, that's not entirely the case. In JSF the view is whatever the VDL loads and which contains the components. In practice this is the .xhtml Facelet file.<br /><br />The controller is the FacesServlet.<br /><br />See also this section on Wikipedia: http://en.wikipedia.org/wiki/Web_application_framework#Push-based_vs._pull-based<br /><br />About being "pure" MVC, in reality none of the MVC web frameworks is that. In "pure" MVC (as introduced by Smalltalk) a model can for instance update the view on its own. To quote myself:<br /><br />> <i>Part of the reason why it's often not entirely clear in JSF and many other web frameworks which parts of it correspond to which part of MVC, is that the MVC pattern was originally devised for desktop applications.<br /><br />In a desktop application, the nodes M, V and C are a maximum connected graph, meaning each part can communicate with every other part. E.g. if the model changes, it can push this change to the view. This is particularly visible in case there are multiple representations of the view in a desktop application. Change one, and see the other update in real-time.<br /><br />Due to the client/server and request/response nature of web applications, classic MVC doesn't map 1:1 to most web frameworks.</i><br /><br />About the following:<br /><br />> <i>JSF does not give fine grained control over the HTML, Javascript and CSS.</i><br /><br />Well, having fine grained control over HTML, Javascript and CSS is not exactly in the description of the MVC pattern itself.<br /><br />What you may think of as "pure" MVC is perhaps just "the way that Spring MVC does MVC", which is only one of the many ways, and as mentioned is not the original MVC way either. In fact, with its events and setup it has been said that JSF is actually closer to Smalltalk's original MVC pattern than Spring MVC.<br /><br />Whether that's actually the case, and whether JSF has or does not has fined grained control over HTML, Javascript and CSS are both interesting discussion points, but not something I wanted to highlight in this particular article. May be a topic for a future article though.<br /><br />Thanks for your reply ;)<br /><br />Arjan Tijmshttps://www.blogger.com/profile/08548593340781885396noreply@blogger.comtag:blogger.com,1999:blog-4498889353428710313.post-37342786022286363272014-11-26T06:23:01.892-08:002014-11-26T06:23:01.892-08:00JSF is not a pure MVC framework because it has vie...JSF is not a pure MVC framework because it has view and controller mixed together. JSF does not give fine grained control over the HTML, Javascript and CSS. MVC 1.0 is a pure MVC framework and give fine grained control.<br /><br />On the other hand, JSF is a kind of rapid application development framework.Anonymoushttps://www.blogger.com/profile/07425669698514163367noreply@blogger.com