JSF, JPF, Struts, SDO小探

一直对这几个概念不是非常清楚,一直对学习JPF心存疑虑。这几天,花了一点时间,大致上看了一下这几个东西的文档,有了一点收获,和大家探讨一下。
Struts:不用多说,大家都非常熟悉了。
Service Data Object(SDO)是JSR235讨论的一种简化数据访问的结构。在Web应用中,可以使数据源对开发人员透明。
J2EE标准的Java Server Faces(JSF),BEA的JPF,都是基于Struts的,那么有一些什么区别呢?
JSF更多的是关注于页面的表现,很多结构和Struts非常相似。事实上,JSF的操刀者正是Struts的作者。可以在JSF中非常明显地看到,设计思路是在Struts上的提高和完善。比如,在Struts中,ActionForm事实上就是一个Bean,储存了数据。在JSF中,直接引入了Managed-Bean的概念,这些储存有数据的Bean可以直接放到页面上,这些Bean由程序员完成,美工只是直接把BEAN拖放到页面上,这样,进一步分割了Model和View,简化了开发过程,更加便于协作开发。
BEA的JPF更多地注重页面和数据的绑定。事实上,绝大多数的动态Web页都涉及到数据的读取和存储,JPF封装了大量的数据绑定功能,也简化了这一类的开发。
从IBM的红皮书上可以看到,现在IBM的所有涉及到JSF的例子,都用了WDO(WebSphere Data Object)。我的理解,这是SDO的一种。事实上,SDO还只
是处于JSR状态下,IBM实现了部分的SDO规范的功能。在IBM的例子中,可以看到,通过JSF和WDO/SDO,页面可以很容易地绑定数据,显示数据。
这一点,和BEA的JPF有异曲同工之妙。巧合的是,JSR235 SDO规范专家组的领头人正是BEA和IBM。
由此,我得出如如下的结论:
1、JPF是基于Struts的,将来会基于JSF
2、JPF和Struts/JSF不是一个层面的东西,JPF是比后两者更高级的框架
3、JPF在某种程度上,是BEA的SDO实现,将来的SDO正是规范中,必将有JPF的影子
4、虽然IBM现在在热推JSF,但是其红皮书中承认,JSF目前还是非常新的技术,并不完善,还有待于得到广泛的支持。Apache正在开发JSF-Struts库,
以便于Struts到JSF的迁移。所以,现在不必急追JSF,有了扎实的Struts知识,迁移到JSF不会太困难
5、学习JPF是安全的,(这和我以前的观点不同,以前对于JPF了解不深刻,向BEA致歉),将来的SDO会有JPF的影子。
欢迎大家讨论。

都劳动高人了,荣幸荣幸。
在JPF刚出现的时候,就得知BEA非正式地提供了可以迁移到Tomcat的工具。凭借BEA的实力,我毫不怀疑,将来的Java Control和JPF等,都可以顺利地移植到Tomcat或者WAS上运行,甚至连运行库都不需要,直接翻译成标准的Servlet代码。这是完全可行的。
我前面所说的都是从程序员开发的角度谈,不涉及运行时兼容的问题。Beehive把Workshop Runtime开源了,大家都可以来研究了,非常有利于Workshop的推广。但是,并不是开源的东西一定可以成为标准,承认吗?Tapestry也很不错,也是开源的,但是偏偏Struts最为市场接受,成为了事实上的标准。
我们是不是不能排除这样一种可能,Beehive开源了,也在一定程度上被广泛接受了,但是就是没有成为标准。成为标准的是JSF+SDO,假设这样。那么,作为程序员,我就有风险了。我花了时间精力,学习了Workshop Framework,也很精通Java Controls了。我毫不怀疑,我写的程序,可以被deploy到任何J2EE兼容的App Server上去。
另一方面,移植的过程是很复杂的,谁都不能保证移植的程序100%可运行。但是客户的平台是多样化的,出于以后维护的考虑,比如客户是小公司,一直运行Tomcat,他的维护工程师只懂JSP/Servlet/Struts,不懂JPF,那么为了维护,他也希望我用他懂得技术开发。即使我的JPF应用顺利部署到他的Tomcat上,他对今后他将面对的维护也会有畏惧。我总不能强迫他学JPF吧。
而且客户,都有一种惯性。用惯了.NET的,你向他推荐J2EE都很困难;同理,如果向他推荐非常先进的JPF,客户未必接受。
我,作为程序员,有交流的问题。比如说,JSP/Servlet,只要是J2EE程序员,大家都懂。无论在Team内部,还是到dev2dev,developerWorks, TSS上,大家都用同样的语言,JSP/Servlet规范和相关的术语。同样的道理,Struts由于是事实上的标准,也是可以被无障碍交流的,大家都懂ActionForm, ActionServlet。但是,只要Workshop一天没有成为标准,就有可能成为一种外语。我在BBS上跟人讲,NetUI:XXXX,不是人人都懂,我讲JCS,JPF,别人就未必懂。我只能到dev2dev,找你Hilaser请教。
其实,我认为,标准的含义对我而言,就是方便与人交流。UML语言诞生的初衷也是为了交流。虽然,大家都知道,JPF的底层就是Struts,但是偏偏封装后,名字改了,虽然都是巧克力,但是你说它叫“朱古力”,可我只知道他叫“巧克力”怎么办?那就要求我必须同时懂得Struts和JPF,自己给自己翻译了。或者用工具,把JPF转换成Struts,然后拿着机器生成的Struts代码和人讨论?
谈到这里,所有问题的根出现了,那就是
* BEA是否有足够的实力,把自己的专有技术推广成标准 ? *
是要所有的人都接受,成为标准;而不仅仅是开源。
这里有太多的非技术因素。且不说BEA的股价,庞然大物如IBM或者Oracle的态度。作为客户,他是否愿意押宝在BEA身上,明确BEA的JPF等技术就是将来的J2EE规范呢?恐怕比较难。即使庞大如IBM,客户也不会下这种赌注。客户一般都喜欢用成熟的技术。EJB2.0的规范出现是在哪一年?看看EJB2.0开始广泛运用又是在哪一年?
这也是,WebLogic这么多年来备受青睐的原因,因为他的技术最标准。所以,我的建议是,在JPF明确成为事实上的标准前,还是持观望态度比较合适。因为JPF和基于J2EE规范的不同Implementation不同,JPF的API是独特的,事实上一个程序员如果只精通JPF,而不懂Struts和JPF的关系的话,那他就真的被绑在BEA上了。对于Struts、JSP/Servlet群来说,他是一个外星人。那么用漂亮的Workshop开发JPF的人,又有多少会想到去了解底层的Struts呢?
其实,BEA为什么要重新搞一套特殊的API呢?Struts的不足,可以在保留Struts API的基础上,进行扩展,没有必要全部改头换面。保留Struts API的TAG要省多少事啊,再加上BEA的扩展,不一样可以吗。为什么全部换掉呢?
JPF的技术真的不错,但是,我只了解大致原理,我不去看具体的语法API,我等它成为标准。

Similar Messages

  • JSF And Struts Integration

    Can any body give some info on integration of JSF to existing struts application

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • JSF and Struts - differences and integration goal.

    I am a newbie J2EE developer and I am not clear about main differences between JSF and Struts also I saw couple of articles describing integration between JSF and Struts. Could someone give me an explanation, what the main conceptual differences between those technologies and what's the goal of integration both of them?

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • JSF or Struts

    Hi,
    We have a web application designed using MVC framework. Besides a web view, we now need to support mobile users using WML.
    We are considering JSF and struts (customising struts to handle WML client).
    I have read that JSF supports disparate clients efficiently using RenderKits.
    Can anyone suggest whether JSF has an easy to use WML RenderKit. How does a renderkit work? Is there any good documentation online?
    Is there a Renderkit for WML readily avaialble or will I have to make one? I know there was a link posted in one of the questions in this forum, but it is a dead link.
    Thanks in advance,
    Harsha

    JSF is better than Sturts. ("Until now there is no sucess story on JSF.")
    Becoz, Struts inventor has been hired by SunMicroSystems to work with JSF. The same guy mentioned in an interview, that struts developement will be stopped in future.
    Also..,
    Until now there is no sucess story on JSF. Only time can decide which is best.
    My suggestion is, better spend your time in learning more jsp and servlets specifications, XML/XSLT, JMS, Webservices rather JSF/Struts.
    All these frameworks like JSF/Sturts will depends on your project requirement. There is a nice book and online document in this website about design patterns. Read those things if you have time. You will get good idea.
    Well.., this is all my personal opinions.

  • Using jsf with struts

    hi;
    i am trying to understand the proper architecture when using jsf and struts together.
    i think i understand the differences between the technologies . it seems to me that instead of justifying jsf there should be a focus on how the two technologies actually collaborate.
    specifically, i would like to know or see examples of things like replacing the view portion of struts and plugging in the jsf framework instead or how to i replace the struts actions with jsf commands or maybe they are totally different things.
    where can i get information like this?
    thanks.

    At present, i think the best thing to do is to look at the example provided with the struts-faces integration taglib. I don't know any documentation about it.
    http://cvs.apache.org/builds/jakarta-struts/nightly/struts-faces/

  • Steps of Integrating JSF with struts

    Can anybody tell me the steps of intrgrate JSF with Struts
    Regds
    Amit Verma

    It's a better idea to upgrade your memory amount up to at least 1GB.

  • JSF versus Struts

    Hi, I'm researching JSF and Struts and they look identical. Seems like the developers of JSF just took Struts and changed the wording. What I mean is:
    struts-config.xml became faces-config.xml
    ActionMappings and Actions became NavigationCases and NavigationRules
    FormBeans became ManagedBeans
    MessageResources became MessageBundle
    ActionServlet became FacesServlet (in web.xml)
    Both have validators and converters.
    So am i missing something?
    Also, are there any performance benchmarks that JSF/Struts add to response times?
    Thanks,
    Mike

    I tried out JSF on some small projects and it worked out OK. However, when I tried using JSF on a major project, I got burned. I ended up converting all my JSF work to Struts.
    Before I say what I didn't like about JSF, let me say what I do like. I like how easy it was to associate a button or a link with a method. I like how easy it is to validate input. I liked how easy it is to show or hide components based on boolean expressions. When it comes to these things, I was able to develop code a bit faster with JSF than with Struts.
    However, the negatives were so great that I eventually abandon JSF...
    (1) If you have a graphic artist that creates prototypes using static HTML, converting those prototypes to actual working pages is MUCH easier with Struts tags than with JSF tags. The problem with JSF tags is that you cannot always mix JSF with standard HTML. This is especially true if you are using Tiles. You may end up having to completely rewrite the static HTML tags to their JSF equivalent. This is simply more trouble than it is worth. (There are JSF tag libraries available that act like standard HTML tags, but I found the tags to be buggy and the code simply very cluttered.)
    (2) Creating tables much more complicated that a textbook example can end up being more trouble than it's worth. For example, if you want to create a table where some rows are sub-headers (rows that span all columns and contain a sub-title), then you will end up having to create a custom renderer and a custom tag library. There is a learning curve involved with this. (Even if you are an expert in writing these, you still have extra code that needs to be written.) With Struts, the same thing can be accomplished with some simple logic tags.
    (3) Sometimes, all I really wanted was to iterate through a list of values. JSF does not come with a simple iterate tag. You can loop through your data with a JSTL tag or you can use a datatable or you can create your own tags, but that is extra work. Even if you choose to do any of these, you still cannot reliably mix standard HTML tags with JSF tags.
    (4) Everything in JSF is submitted as a POST. Sometimes, I really needed to use a GET. You can use GETs in JSF, but I found using them to be less than straightforward.
    My advise: If you are building a web app, use a framework that plays well with HTML. (Ultimately, your web app is generating HTML anyway.) If you are building a stand-alone app, use Swing or some language other than Java. If you need your code to run as both, then JSF might be a solution.
    I really wanted JSF to work for me, but I ended up being disappointed.

  • JSF vs Struts article on Websphere Journel

    This article lists some of the common areas between JSF and Struts and shows the pros and cons of each technology in each area.
    http://www.sys-con.com/story/?storyid=46516
    Ed (JSR-252 Spec co-lead)

    Hmm I can't access that :(
    I liked Craig's blog post about the both tecnologies, I think that everyone should read that.
    http://blogs.sun.com/roller/page/craigmcc/20040927#struts_or_jsf_struts_and

  • JSF vs  Struts  And  Best O/R mapping  tech.

    I want to start working again after 3+ years gap from 2003 to 2007.Earlier for 4 years I have worked on web/enterprise applications and technical platform was JSP1.2,SERVLET 2.x,Oracle's xsql servlet,JDBC ,Struts1.0/1.1,statleless Session Bean ,Web Service generated by BEA WEBLogic server 8.1,jdk1.3.
    I've been looking through too many documents and forums, there are so many choices now .Could you please suggest which of the following should I learn to update my skills :
    1.JSF OR Struts 1.2,1.3 OR Struts2 ( There are no books for Struts 2)
    2.Hibernate OR EJB3 OR Torque OR TopLink
    3. jdk 1.4 OR java 5
    Can you help me to findout documentation and tutorials to learn these .
    Thanks

    You're wanting to get back into writing web applications?
    Web services?
    1 - If you worked with struts before, I'd probably continue with that line. Or at least start there.
    2 - I'd say Hibernate, but then I don't know that much about the others ;-)
    3 - Java1.5.
    I would also recommend you catch up with the changes between JSP1.2 and JSP2.0, particularly regarding JSTL and EL.
    For learning JSTL, you can't past go the JSTL spec. It is quite readable, and an excellent reference. http://java.sun.com/products/jsp/jstl/reference/api/index.html

  • Migrate from JSF to Struts?

    Hi
    I have seen some threads in this form regarding migration from Struts to JSF. Most of the posters back then (1999-2003) suggested starting with Struts and then migrating to JSF for production.
    Now I have one year of experience with Struts in a Tomcat environment and practically no experience with JSF. My current job involves maintaining JSF code. The boss thinks migrating to Struts would make us independent of the company to whom the JSF project was outsourced.
    I would like to know your opinion on migrating from JSF to Struts. How hard is it? Our architecture has Views, View Helpers, Business Context objects, Business Delegate objects, Business Processor objects, DAO (DB2, AS/400), DTO, etc. They seem rich enough semantically when compared with Struts that groups all these under MVC, even though they are complex to manage (job security :).
    I'd appreciate your feedback.
    Thanks
    Murthy

    To quote Ron Burdundy, "That doesn't even make any sense!" :) Seriously, though (and I admit a huge bias), that seems like a huge step backward. It seems the logic is this: "We outsourced the development of this system to someone else, and now we're left either maintaining it ourselves or paying them to do it, but, if we rewrite it with $FRAMEWORK, we'll be free of them." Is that right? How is maintaining a Struts app different (frameworks aside) from maintaining a JSF app? This is probably obvious, but that's a step I would neither take nor suggest. :)

  • Using JSF and Struts

    I am a bit of a newbie in terms of UI applications on the JEE platform, so I apologize up front if this question seems silly. I was wondering if someone could comment on the approach below. Is this something that's possible or am I barking up the wrong tree?
    We have a vendor application that is written using Struts. We want to add a section of our own pages to this application, but we would rather use a more strategic approach in our pages, so we would like to use JSF for those.
    The original web.xml file in the vendor app uses a dtd of version 2.3 as shown below:
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    When I use JSF, I use a DTD version of 2.5 as shown here:
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    The problem is that when I use version 2.3, the elements needed to support JSF are invalid. When I use 2.5, the elements needed to support struts are invalid.
    Could someone comment in that, if you had this vendor app and you needed to add your own pages, is it not possible to use JSF in this scenario or if you can, what is the best approach to resolving this issue?
    Thank you in advance

    First make sure that your application server supports Servlet API 2.5. Whether the desired Servlet API version is supported or not solely depends on the application server implementation and version used. For example Tomcat 5.5 is a Servlet API 2.4 implementation which only supports the API versions up to with 2.4. If you want to use Servlet API 2.5, then you obviously need a Servlet API 2.5 implementation, for example Tomcat 6.0.
    Consult the website and/or documentation of the application server in question.

  • JSF and Struts

    Why would I still want to use Struts? Doesn't JSF elimintate the need for Struts?
    Can someone please give me the low-down?
    Thanks,
    Michael

    I like Struts a lot and I see it working well with JSF. But I
    am also very impressed with the Tapestry project just brought
    into Jakarta; it seems so much further along than JSF.

  • Oracle portal using JSF, JSP, Struts framework

    Hi ,
    Can anyone tell me how to build an oracle portal using JSF,Jsp and Struts Framework.
    Also please provide any manual or documentation for developing oracle portal.
    Thanks in Advance,
    Raghav

    At present, i think the best thing to do is to look at the example provided with the struts-faces integration taglib. I don't know any documentation about it.
    http://cvs.apache.org/builds/jakarta-struts/nightly/struts-faces/

  • Managing blob images using ADF and JSF or struts

    Hello everyone. I am an ADF newbe and I am developing a web app. that has to manage (display, insert,update and delete) blob images from/to an oracle DB. I've seen the "howto" on image managing using intermedia and struts, but, for this new app I wanted to use JSF (something that is not mandatory) and, what is important is that the DB has already stored the images in blob format.
    Can anybody point me in the right direction please??? Is there any howtos on this subject???
    Thanks in advance.

    jfin wrote:
    but so far I have to say that I like the fact that I'll have to do very little
    System.out.println(<..../>....<>....</>).Assuming that you rather mean out.println() where out is the ServletOutputStream reference returned by HttpServletResponse#getOutputStream(), I can only agree with you. That's certainly not the way how JSP/Servlet code is to be written. The maintainability, extendability, reusability and testability would be far below the freezing point then. You need to write presentation logic in JSP files, not in Servlets and absolutely not in scriptlets inside a JSP.
    When you need to write presentation logic which may change per request, use JSTL and EL for that. Again, not scriptlets. For business and controlling logic, use Servlets. For transfer of data, use javabeans (DTO's, VO's). For data access logic, use DAO classes which are to be interacted by servlets.
    JSF removes the need for creating Servlets and using JSTL/EL in JSP files. You just have JSP pages with JSF tags for presentation and javabeans for the request values and backing beans for business logic.
    When would one use JSF over the other two? When Struts2? When Shale?And you ask that in a JSF forum? At least my opinion is predictable :)

  • Problem with opening PDF files from JSF page using SDO

    Hi all,
    I'm new with JSF and was attempting to read a PDF file from a Database using SDO and JSF. The code below throws an exception when casting from DataObject to Blob. The getLcDoc() method was created by WSAD when I dragged an SDO relational record onto the JSF page. This method returns an DataObject type which I tried casting to a Blob type before using it further. However, an exception is thrown.
    Any feedback is appreciated.
    Arv
    try {
                   FacesContext faces = FacesContext.getCurrentInstance();
                   HttpServletResponse response =(HttpServletResponse) faces.getExternalContext().getResponse();
                   Blob file= (Blob)getLcDoc().get("ATTACH");
                   int iLength = (int)(file.length());
                   response.setHeader("Content-type", "application/pdf");
                   response.setHeader("Content-Disposition", "inline; filename=Attachment");
                   response.setHeader("Expires","0");
                   response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
                   response.setHeader("Pragma","public");
                   response.setContentLength(iLength);
                   ServletOutputStream os = response.getOutputStream();
                   InputStream in = null;
                   in = file.getBinaryStream();
                   byte buff[] = new byte[1024];
                   while (true) {
                   int i = in.read(buff);
                   if (i<0) break;
                   os.write(buff,0,i);
                   os.flush();
                   os.close();
         } catch(Exception ex){
              System.out.println("Error while reading file : " + ex.getMessage());
         }

    Hi...I found out that there is actually no need to use a Blob object at all. You can simply call the OutputStreams write() method and pass the DataObject.getBytes() method that returns a byte[] array. The revised code is shown at the end of this posting.
    However, a few other teething problems exist:
    1. This works well only if I specify the content type in response.setHeader() method. What if my users upload different types of files, is there a way that the browser opens according to the file type without setting the content type?
    2. I still have a problem opening PDF files, even if I specify - response.setHeader("Content-type", "application/pdf");
    I get the message - The file is damaged and could not be repaired
    3. I would also like this to open the attachment in a new window and using target="_blank" doesn't seem to work as seen below:
    <h:commandLink
                                                 styleClass="commandLink" id="link1" action="#{pc_DocumentDetailsRead.doLink1Action}" target="_blank">
                                                 <h:outputText id="text5" styleClass="outputText"
                                                      value="Click Here"></h:outputText>
                                            </h:commandLink>
    ------------------------Revised code-----------------------------------------
    FacesContext faces = FacesContext.getCurrentInstance();
                   HttpServletResponse response =(HttpServletResponse) faces.getExternalContext().getResponse();
                   response.setHeader("Content-type", "application/msword");
                   response.setHeader("Content-Disposition", "inline; filename=Attachment");
                   response.setHeader("Expires","0");
                   response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
                   response.setHeader("Pragma","public");
                   ServletOutputStream os = response.getOutputStream();
                   os.write(getLcDoc().getBytes("ATTACH"));
                   os.flush();
                   os.close();

Maybe you are looking for