`
honley
  • 浏览: 118611 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

我为什么重新考虑JSF

阅读更多

原文地址:http://blog.brunoborges.com.br/2013/01/reasons-to-why-im-reconsidering-jsf.html

 

In December 2010, I wrote a blog post entitled "Top 10 reasons why I don't like JSF", and I would guess that 50% agreed with me, the other 50% did not. No surprise, it's like religion.

I always liked to research products, projects, frameworks and Java technologies in general, but specially in the Web Development area. In 2001, I started coding JSP and Servlets, just a few months after I learned how to program in Java and do OOP . Did my first web application connecting to an Oracle DB with pure JDBC. Learned from the basics, on my own and succeeded.

Later I got a new job, thanks to my experience in Web Development, but my employer was using Apache Struts. I knew about that upfront so I studied it before my interview. Got hired. Struts back then, wasn't that hard for someone already with knowledge about HTTP request/response architecture and the Servlet specification. Then came JSF 1.0. I didn't like it. Complex. Way too much. Struts was much simplier. JSF 1.1? Same thing. Small improvements only.

So I moved to something different. In 2007, I heard about Apache Wicket. Then I became an independent evangelist. I gave several talks in Brazil, for years, spreading my word about Wicket, at every conference my talk was approved. I even created a community, Wicket em Português, for Portuguese speakers. I also offered an online training for it. I was offered a job proposal just because I knew Wicket, in Rio de Janeiro in 2010.

Now, the reason I told you all this is to show you that I'm used to choose what works best for me, at a certain time. I do change my opinion over things. It's something like, readaptation. We all should readapt. Every time. Just to demonstrate: I was born in an island, Florianópolis, then I moved to São Paulo, later I moved to Rio de Janeiro. Now I'm back to São Paulo. My accent changed, thanks both because I like to talk like others to make jokes, but also to feel like a local. By the way, I'm a CouchSurfer. I enjoy traveling and being with, and like, locals.

Now let's get to the real thing: Java Server Faces 2.2. The version that is leading me to readaption.

Before start, I should point that I now work at Oracle and I advocate in favor of Java EE. I'm friend of Arun Gupta, Reza Rahman, Ed Burns and several other folks who are Java EE advocates, also some who are not Oracle employees.

When I wrote about the things I didn't like in JSF, some were technical, others were related to its ecosystem and the market. Things that change, that evolve. And they did.

1. Pure HTML
I talked to Ed Burns several times about the way we design pages in JSF, with tag libraries. At the first opportunity, years before joining Oracle, I told him: "Hey, why don't you make it look like Wicket?". Facelets came at some point between that day and later. Now, in JSF 2.2 it's possible to define a page using pure HTML, letting the browser do the preview without much hassle. Something I enjoy a lot in Wicket and other frameworks. Something I talked a lot at my presentations. So here it is, the community (represented by myself and many others), influencing change in an specification.

2. Implementations
I think that relying on whatever is running on your application server (Mojarra or MyFaces) is better. If you are considering JSF, you should choose a Java EE certificated app server and just use whatever comes within. Life will be much easier this way.

3. Creating custom components
In JSF 1.x, creating a custom component was more difficult than creating YAJWF. Now is a one-file-in-a-directory only. It's very easy to compose a custom, reusable component. This post will give you an idea.

4. Documentation
I used to complain about JSF documentation (fragmentation). Apparently, documentation got a lot better. The Java EE 6 homepage at Oracle offers hundreds of pages of documentation. Of course you can always look somewhere else for docs, but I would go to these first, as these are the "official" docs, much like when you go to SpringSource for Spring MVC documentation.

5. Tooling Support
I've been playing with NetBeans for quite a while and it is a good IDE for Web development. But if you are really into HTML5, then you will like JSF inside NetBeans. The IDE now provides a feature, from Project Easel, that integrates with your browser and provides debugging and many other features. Good for someone doing HTML5 development with JSF 2.2 and JAX-RS. By the way, there is some work going on, according to Ed Burns, on integrating JSF 2.2 and JAX-RS 2.0. So let's keep an eye on that.

6. Other new features
Some otther new features are about to come as well. Here are some tickets in JIRA that are being prioritized, like:

  • Loading Facelets through ResourceLoader
  • Ajax File Upload component
  • Cross Site Request Forgery Protection
  • Faces flows


99. Java EE advocate
I always was an advocate of the platform though never of all of its specs. And one of the reasons I took the job at Oracle as Product Manager, was because I have been working with Java EE since... ever. Not with JSF specifically I confess, not always, but I was already considering it since it turned 2.0. And facing the challenges of teaching developers to do non-Java EE development the right way, I had been thinking of adopting it fully, simply because it's easier to find skilled developers of the platform. This is a great deal for employers when their time-to-market is important.

Still... some gaps
If there's something that I still think that happens, is the compatibility between implementations. The TCK does not cover everything, because of gaps in the spec. So it's not guaranteed to say that a project running with PrimeFaces or RichFaces on top of Mojarra will run just fine if you move it to an application server running MyFaces. But this is something that can be fixed, and I'm sure it's being addressed by all parties (JSF EG, myfaces-devs and mojarra-devs).

Also, it would be nice to see more things like server-side UI programming, as it happens with Apache Wicket. Maybe even having support for different languages? It would be nice to have the server-side UI logic in Javascript, for example. :-)

Java EE 7 and the future
Non standard frameworks are good for innovation. Some may not agree, but JCP and standards are not that slow anymore. Of course they still are if you compare to stuff like Node.js, Wicket, Liftweb, Play!, Rails and other great alternatives for web development. But look at JSF 2.2 and Java EE 7. We are about to see the new version of Java EE about the same time as HTML5 comes to a final version. In old days, it could be like having Java EE supporting HTML5 in... what? 2018? Not anymore.

Also, if you want to use JSF with CDI, you should really consider an application server with at least Java EE Web Profile, like Apache TomEE. Oracle GlassFish and JBoss are another option if you are looking for open source solutions. The reason to choose a compliant Java EE app server is that they already offer (and test) these kinds of integrations (e.g. JSF with CDI).

So yes, I look forward to Java EE Platform 7.0, not only as an advocate, but specially as a developer. I'm seeing its value, its improvements, and its readaption to the market.

Openness to Change
Let's not forget, the Adopt-a-JSR program offers the community, a great opportunity to participate, speed up, and improve even more the platform and all of its specifications. So here's your chance to ... why not, fill the gaps? :-)

Cheers!

分享到:
评论

相关推荐

    jsf分页 jsf分页 jsf分页

    考虑到JSF的请求范围,确保分页状态(当前页、每页记录数等)在请求之间正确保存。这可以通过在ManagedBean中使用合适的范围(如ViewScope或SessionScope)或利用隐含对象(如`#{flash}`)来实现。 综上所述,JSF...

    jsf1.2 jar包下载

    JavaServer Faces(JSF)是Java平台上的...因此,在现代项目中,可能需要考虑升级到更现代的JSF版本,如2.x或3.x,以利用最新的功能和改进。同时,为了确保兼容性和安全性,应及时关注并应用官方发布的补丁和安全更新。

    介绍JSF框架的PPT

    #### 二、为什么选择JSF? ##### 1. 高度抽象 相比于其他框架如Struts,JSF提供了更高层次的抽象,这意味着开发者可以更加专注于应用程序的核心逻辑而不是框架细节。此外,JSF还为Web应用程序提供了基础的支持,但...

    jsf 用户登陆界面

    JSF(JavaServer Faces)是Java平台上用于构建Web应用程序的框架,特别适合开发用户界面。在JSF中,用户登录界面是常见的功能模块,用于验证用户的身份。下面将详细讲解如何在JSF中创建一个用户登录界面。 1. **JSF...

    用jsf做的登录注册的组件

    JSF(JavaServer Faces)是一种用于构建Web应用程序的Java技术,它提供了一种声明式的方式来创建用户界面,并处理用户交互。在这个"用jsf做的登录注册的组件"中,我们可能会涉及以下几个关键知识点: 1. **JSF架构*...

    jsf 实现

    JSF,即JavaServer Faces,是Sun Microsystems为Java平台提供的一种用于构建基于Web的应用程序的组件框架。JSF1.2作为JSF的第一个主要版本更新,引入了多项改进和新特性,包括但不限于增强的事件处理、更丰富的组件...

    JSF基础教程 简体中文

    藉由以下的几个主题,可以大致了解JSF的轮廓与特性,我们来看看网页设计人员与应用程序设计人员各负责什么。 o 简介JSF o 第一个JSF程序 o 简单的导航 Navigation o 导航规则设置 o JSF Expression Language o 国际...

    JSF 简介(英文)

    JSF在设计上考虑到了与工具的紧密配合,使事件能够轻松地与服务器端代码相绑定,同时提供了易于扩展的机制,以及管理用户界面状态的能力。 二、JSF的设计模式与架构:JSF遵循经典的Model-View-Controller (MVC) ...

    jsf 实例 登录 helloword

    JavaScript Server Faces(JSF)是Java平台上的一种用于构建Web应用程序的MVC(Model-View-Controller)框架。在这个“jsf实例登录helloworld”的主题中,我们将深入探讨如何使用JSF来创建一个基本的登录页面,这是...

    jsf自带分页

    如果JSF自带的分页组件不能满足需求,你可以考虑自定义组件。这通常涉及创建一个新的UIComponent子类,以及处理相关的渲染和行为逻辑。 6. 性能优化: 分页功能需要考虑到性能问题。例如,避免一次性加载所有数据...

    JSF 一些经验 .doc

    Seam 是一个为 JSF 提供增强功能的框架,它能够无缝地与 JSF 集成,并且不仅仅局限于 EJB3 和 JBoss 平台。通过添加 Seam 的 Phase Listener,可以显著增强 JSF 生命周期中的异常处理能力。即使不使用 Seam 的其他...

    JSF 上传文件例子

    - 安全性:考虑防止恶意文件上传,例如限制文件类型、大小,并进行病毒扫描。 总之,尽管JSF在原生支持文件上传方面存在不足,但通过开发自定义组件或利用第三方库,开发者可以有效地实现文件上传功能,以满足其...

    JSF经典的js分页

    2. **页面配置**:在JSF页面(通常为.xhtml文件)中,你需要设置分页控件,如页码按钮和每页显示数量选择器。这些控件可以通过JSF的UI组件实现,如`h:commandLink`或`p:commandButton`。 3. **JavaScript实现**:...

    jsf2segy.zip

    JSF全称为“Jiffy Seismic Format”,是一种专有的地震数据存储格式。它可能由特定的地震采集或处理软件使用,以存储地震波形、元数据和其他相关信息。JSF格式可能包含一些特有的结构和编码方式,这使得它在不同软件...

    ajax的框架dwr整合jsf

    本文将详细介绍如何使用DWR框架来整合JSF,为初学者提供一个入门指南。 1. **DWR简介**:DWR的核心功能是创建了一个JavaScript到Java的远程调用层,使得前端的JavaScript代码能够像调用本地函数一样调用服务器上的...

    JSF实现的文件上传

    **JSF实现的文件上传详解** JavaServer Faces (JSF) 是Java平台上的一个用于构建用户界面的组件模型框架,它允许开发人员创建基于Web的应用程序。在JSF中实现文件上传功能,不仅可以处理小文件,也能有效地上传大...

    JSF学习

    在某些情况下,甚至可以考虑将两者结合使用,以充分利用各自的优点。随着技术的发展,开发者应保持开放心态,根据实际需求灵活选择最合适的工具和技术。 总之,无论是选择JSF还是Struts,关键是理解它们的核心概念...

    JSF分页组件2

    - **缓存计算结果**:避免每次分页请求都重新计算数据,可以将当前页的数据存储在Bean中。 - **延迟加载**:只在用户实际访问某一页时才加载对应的数据,减少初始化时的资源消耗。 - **预加载**:考虑到用户可能会...

Global site tag (gtag.js) - Google Analytics