Is this a fare assessment of JSF (RI 1.1)?

After playing with JSF for a week, I need to tell my manager what I think of JSF. If anyone takes issue with anything I've written below, I'd be interested to hear from you.
David
JSF generates HTML its own way. The commonly adopted process of producing a page design in pure HTML, getting the layout 'just so', then implementing a dynamic version doesn't work with JSF because you can't hope to generate exactly the same HTML. You find yourself having to adapt the screen design to fit in with JSF's way of doing things, or at least come up with a different HTML solution that can be generated by JSF.
The following is a commonly occurring frustration with JSF development: You know how you would achieve something using fundamental principles (e.g. servlets, HTML and scriptlets) but you can't find a way to make JSF achieve the same thing. It often feels like a battle, trying to get JSF to do something that would be quite straightforward if you had more control.
Some of the UI control types are restricted in the ways they may be used. For example, the h:selectOneRadio component, which models a radio button group, assumes all the buttons are located within the same parent element without any interspersed HTML between the buttons. There are many cases where this is too restrictive, e.g. a design where each row of a table begins with a radio button (as a means of allowing the user to select only a single row of the table).
Some control types are not provided (at least in Sun's Reference Implementation), e.g. HTTP file upload. You can implement your own custom components, but this is not trivial.
Quirky behaviour during development slows you down. For example, actions not firing when command buttons are clicked turns out to be due to unreported page translation problems. Have to deduce what's causing the problem by selectively commenting out different portions of the page.
The Sun JSF RI is buggy. After running into a few problems and consulting the Sun JSF forum it becomes clear that the current Sun RI (1.1) suffers from a significant number of awkward bugs.
Limited ability to manipulate the GUI using client side scripting (e.g. to add new rows to a data entry table without the need for a round trip to the server).
JSF is designed to be used with tools but tool support is currently not great. Sun Java Studio Creator looks good on paper but is rather clunky in practise. Its page layout editor only allows components to be positioned absolutely (i.e. fixed size and co-ordinates). This negates one of the great virtues of HTML, i.e. that it can allow content to flow naturally and components can be positioned according to CSS rules.
In summary, the promise of rapid development with JSF is not achieved in practise due to a variety of problems. Many of the problems are to do with the immaturity of JSF. However, the lack of control over the generated HTML (assuming it's impractical to implement custom components to solve each new requirement for custom HTML) seems to be an inherent restriction.
End

Layout is way to restrictive when using tables for rendering in JSF. This is an RI issue, and most likely not the spec as I am sure the spec does not say layout must be implemented with tables.
I am not sure I agree with your comment that a JSP, Servlet, HTML, CSS, javascript developer is less productive than a competent JSF developer. I think JSF is a great prototyping tool, but I don't think it is as flexible as using the fundamental technologies leveraged by JSF. I run into situations where I have to customize components straight from the fundamental tehcnologies. Based on this experience, I will run into situations where the components in JSF will require some sort of customization for a customer. I have found customers that are picky about the presentation and will move components around sometimes as little as a couple pixels. Or they will require slightly different behavior in a component than what is default. The other thing I have learned working in a corporation is that branding changes every couple years. How much investment should it take to rebrand all your JSF pages when you can make it so your pages created in fundamentals leverages one CSS for the entire site? Then when the rebranding comes, all you need to do is modify the CSS and not the JSFs. In particular, I am referring to layout and not look.
Let's say a new javascript or AJAX library comes out with some whiz bang widgets. It is a lot easier to develop with that code in fundamental technologies than in JSF. We can see this with AJAX. AJAX capabilities have been around for a while now, but JSF is playing catchup. That means, if you wanted to take advatage of the benefits of AJAX when it was first around, you would have to write custom code or wait for the widgets to come out. What would have google done for google maps if they had to wait around for JSF to catch up(if hypothetically they are using j2ee)? After all, I am certain they haven't received nice publicity which turned into revenue of some sort by being an example of AJAX design. Where would AJAX be without compelling examples of AJAX? It might still be a side note or we would be using the javascript calls directly to do the asynchronous call back to the server. So, there is something to be said about not having to wait for JSF components to manifest themselves. However, that is not to say that google couldn't have invested in its own set of components, but I am not google and I consume already created components or I put the new widgets directly in the page without leveraging the JSF lifecycle. But your choice in JSF is either to use f:verbatim or create the JSF components. Does your boss want to invest in creating JSF components that may or may not be reused? This is a tough question all bosses should ask whenever venturing down the road of extra development for purposes of reuse. When is the return going to be realized on the investment in creating components? In addition, corporations like to reorganize their business units such that the project may or may not survive the reorg. Where is the investment now? If I was a boss, I would not want my developers creating reusable components as it is a distraction. If I run a second project, I might then look into creating reusable components out of the work from the first project. But I certainly would not do it on the first project. You have no way of knowing if that code will be reused. Essentially, anytime something new that comes out that could be leveraged swiftly in an HTML page, requires more work on the JSF developers part.
By the way, I have to learn how to use f:verbatim correctly. Currently, code that I have stuck in f:verbatim is being rendered outside a subview. I might be using this incorrectly though. I am also using dwr, which I am unsure if I can incorporate into a JSF subview/view without f:verbatim since dwr requires calling a dwr servlet and not the faces servlet. I guess I might be able to get around this by assigning the action on a form dynamically to call dwr instead of faces.
Just my 1/2 cent(I try not to spend my two cents all at once),
TacoEater

Similar Messages

  • I rented a movie. I want to see it using different user on same mac for security reason. How can I do this? Home Sharing fails to do this, so far.

    I rented a movie. I want to see it using different user on same mac for security reason. How can I do this? Home Sharing fails to do this, so far.

    Copy the movie from the current library to the correct library.
    iDevices can only sync to one library at a time.

  • Looking for a desktop replacement, how will this one fare?

    I think I settled on the one I am looking for...
    My price range is probably no more than 1300-1500.
    http://www.amazon.com/Toshiba-X875-Q7190-17-3-Inch-Diamond-Textured-Aluminum/dp/B00AY1FGYK /ref=sr_1_1?s=pc&ie=UTF8&qid=1368339116&sr=1-1&keywords=Toshiba+Qosmio
    Toshiba X875-Q7190
    How will this stand up to some moderate to heavy editing? I am new to the video editing world, coming from music production. I would mostly like to make simple youtube videos for man on the street stuff and work my way up to documentaries and the like, maybe around 45 mins in length or so with lots of graphics and stock footage. Will this be a good bargain for what I am looking for? I would rather it be overkill than get invested in the process of editing only to find out my computer cant cut it...
    Thanks a lot you guys I am always learning more when I come here!

    BTW...this is something I did recently which got me on this kick. I did it on my brothers Dell. I think it was a 17R if im not mistaken. It took it pretty well and rendering was about 2 hours for this 22min clip which is longer than I would have liked. But I didnt do any color correction or get to heavy into it, I was just learning the lay of the land for Pp.
    I will mainly be using AVCHD full 1080p from my Canon Vixia M500 and 1080p from my GoPro Hero 3 Black if that makes any difference...Thanks!
    heres the clip.
    http://www.youtube.com/watch?feature=player_embedded&v=aOcBxMftY9U

  • I live in italy, so my credit card address is italian, even if it is an international master card. I cannot download filsm in english, as I am based italian for my account. there is no way how I could change this so far.

    II want to download films from I the I tunes store. My account there is based on " Italy " as I live in Italy and my credit card has an italian address. But I want to be able to download films in English language, which Apple refuses to acxcept indicating that I have an Italian account . there is no way out of this, seemingly, unless I get myself an English speaking country credit card. Crazy ????

    Due to the demands of the content owner, you can purchase only from the iTunes Store in the country in which you reside, and as proof of that residence Apple can accept only credit cards issued in and billed to that country. You can call this "crazy" if you wish, but it's not by Apple's choice.
    As to the language of films available, that again is by choice of the content owners. If they won't license movies with English audio tracks or English subtitles, there's nothing the iTunes Store can do.
    Regards.

  • Is this possible to do in JSF??

    Hi Crew,
    As per my requirement, I need to develop a framework which takes a fixed format of meta-data and generate the UI as per that meta-data on the fly (Taking care of navigation, method bindings.......and every little stuff). The server will only have the bean objects and there may/may not be entries in the faces-config. Moreover, there will be no JSP's deployed on the server.
    My questions is as follows:
    1) Is it possible to do it using the JSF Framework ? If yes, then how can I do it.......Sample codes/Documents
    Any help is highly appreciated.
    Accid
    Edited by: Accid on Sep 28, 2008 10:06 PM

    Of course it is possible. You will need custom implementations of ViewHandler and NavigationHandler.

  • Will my calendar, etc on the iphone with ios5 and cloud synch with my snow leopard imac not cloud connected?  Not much useful information on this as far as I can see.

    There does not seem to be  much useful information on cloud related matters.  I will eventualy uptae to Lion but not for a while. Meanwhile I would like to know
    if my calendar, etc on the iphone were I to update to ios5 and cloud would  synch satisfctory (usul caveat) with my snow leopard imac not cloud connected?  

    It is a very impressive phone.
    You might want to look at FILES or FILES LITE. I use it for pdf and excel files.
    Also, Trapster is very good for directions. And police radar/redlight cameras.

  • [JSF 2] File upload. Is this feature handled already?

    Hello,
    I need to allow a user to upload many files through the same form.
    This is what I would have done with Struts with this HTML code:
    <input type="file" name="file1" size="62" value="" />
    <input type="file" name="file2" size="62" value="" />
    <input type="file" name="file3" size="62" value="" />and the use of the org.apache.struts.upload.+FormFile+.
    However, I see no direct access to this feature through the JSF 2.0.
    no special <h:> tag.
    Reading old JSF code on the web, Tomahawk or Icefaces were used for this task.
    But today, Tomahawk doesn't support JSF 2, and Icefaces has an 2.0 Alpha 2 version that offers many features except File Upload that is still not working (for their update of the month of January: no updates since?).
    More than that, I was trapped few days ago by a strange behavior of JSF 2.0.
    Setting a "+multipart/form-data+" enctype to my form made JSF 2.0 loop on form validation, without ever submitting it.
    I am sure I didn't dreamed when it happened to me. And removing that enctype made the <h:form> returning to its default "+application/x-www-form-urlencoded+" enctype generation, and everything went fine then.
    But I know that attempting to upload files form a web page involve setting a "+multipart/form-data+" enctype on it... I feel doomed.
    All these questions make me return to you all, again. I wonder if you have succeed in using file upload with JSF 2.0 already.
    What mean do you use for that? Any component already exist that is compliant with JSF 2.0?
    Thanks for your help,
    Grunt.

    Are you aware that multi-part forms are not supported by Servlet implementations out of the box? You need to add a filter or manually invoked multi-part processing to support file uploads in any Servlet based solution.You're right. Until JSF 2 takes benefits from Servlet 3.0 who offers a getPart() function, a filter looks mandatory.
    Therefore, I tried the most advanced "faces" available for file upload: Primefaces 2.0.2, who provides a filter. However, it's not enough. The whole Primefaces solution for file uploading works chaotically. For me, it handles the multipart request well, but isn't able to join the listener the uploadFile tag defines, at submission time. I won't enter into details because this is not the good forum to discuss of that specific trouble of Primefaces. I did post my problem on Primefaces forum, and learned that this feature isn't working well yet.
    Icefaces doesn't offer the file uploading currently. Even its compatilibilty mode to version 1.8 is told (by the release note) not being able to handle file uploading yet.
    Richfaces just began its version 4.0.0 and is far from offering file uploading.
    If creating a working file upload was something possible yet, I can say for sure that any of these "faces" would had offered a working feature the sooner they could. But rather than that, I am reading ideas about some Mojarra 2 low level bugs that would disallow this feature to be implemented at the moment.
    It can't be only a story of a filter to write. That filter would have been written already hundred of times, else. A complete working solution would be shown everywhere.
    Currently, to summarize all, whatever a theorical reason is given, or a practical one (RFE missing, no time to write it, not a critical feature, or even unwished feature, depending of everyone thoughts in the previous replies to this post), file uploading is not available for JSF 2.0 by any existing way. No tier API or Faces is able to provide it, as it could be easily proven by the fact... that no samples are currently existing, working.
    Myself, but I might be alone believing it, I consider this missing feature like a JSF 2 flaw.
    I guess its a mojarra internal bug that disallows developers to provide a solution yet. This is not abnormal: JSF 2.0 has six months only, and can't work perfectly yet.
    But the more the correction of that feature will be delayed, and the more the developers will be in trouble, as nothing else is able to work in compatibility with JSF 2.0 (no existing working sample, I need to repeat it). And worst than that, this kind of flaw is one of those that in enterprise, at decision time, can makes JSF 2 discarded for another framework, less smart, but doing everything expected. It would be a shame, then.
    So, I think this problem should not be taken disdainfully. It's not a matter of "+You should only put a filter here+", "+It's not our work+", "+Please write our specs+", "+Wait, only wait, it will come for sure one day...+". Its more significant than that. It requires your study. The one of competent people like you are, and having goodwill. Because I understand that this is a problem that has been thrown away since a long time! But it is returning back to us like a boomerang at great speed.
    Among the features that JSF 2 offers and the ones that are currently under development, they are many, many of them, that will look secondary if at the end of all, file uploading isn't available.
    Regards,
    Grunt.

  • Is About this mac/more info/power reliable for battery capacity assessment

    Hi,
    I calibrated my brand new battery for my Alubook 15". Here are the results :
    First cycle : 4200 mah
    Second cycle : 4520 mah
    Third cycle : 4370 mah
    Fourth cycle : 4220 mah
    Fifth : 3920 mah.
    The battery was sold for 4700 mah.
    1. Does this get any sense ? would you worry about future battery performances based on this capacity decrease from the third cycle ?
    2. I have read that resetting PRAM may reset this battery power assessment to more reliable data : Any experience about this ?

    Luc --
    You raise some interesting points, at least one of which we debated (without resolution ;-)) prior to the change over to the New Discussions -- that concerned whether the batteries used by the new revision of PowerBooks were qualitatively different than the ones used by previous revisions. I don't think we came to a firm conclusion on this.
    But on two other points you raise we did at least draw some firm observations, if not flat out conclusions.
    The first has to do with the 10.4.3 update and whether it may have had power management effects for the better. I personally noticed a slight increase in my battery life since the update, which I have attributed (at least in part) to the fact that a process that runs almost all the time in the background (having, I think, something to do with the trackpad and related functions) called "kernel_task" now runs at about half the CPU usage that it used to. It used to regularly consume 7-8% of my CPU resources. Now, when I check in Activity Monitor, "kernel_task" regularly consumes about 2.5-3.5%.
    The second relates to the new PowerBook revisions, their greater stated battery life and any hardware changes made in them that may be responsible therefor. Here, I remember reading in several places on these Boards and elsewhere that the type of RAM used by the new PowerBook revisions, i.e., PC2-4200 DDR2 SDRAM (running at 333 MHz), while it may not necessarily be faster than the type of RAM used in the previous PB revisions (PC-2700 DDR SDRAM) (since both types of RAM are running at the same 333 MHz in each model), the DDR2 RAM used in the new revision PBs does consume significantly less power to run. Therefore, it seems to have heavily contributed to the new revision PB's claim to longer battery life. Indeed, I've read that since both RAM types run at the same speed in the PB, it was precisely because of the low power consumption signature of the DDR2 RAM that was the reason it was chosen for the new revision PBs.
    Well, good luck testing out your new PB and it's battery. Let us know how it all turns out and, of course, feel free to post back if we can be of any further assistance.
    Bonne chance! A bientôt.
    Oh, by the way, as for battery capacity and degradation over time and with use, you might find my own statistics to be of interest. I've run off battery power quite extensively since I got my PB in March of this year, and, after 164 complete cycles in about 9 months of use (including may times where the battery was completely drained), my original stated capacity of 4400 mAh has only decreased to 4228 mAh (using the same Apple battery that came with my PB when I first got it). I think that's pretty decent from what I've heard and seen with others.
    Later.
    -- JDee

  • Dynamic JSF GUI and associated backingbeans

    I'm designing a web application using JSF. One of the main requirements is that our GUI needs to be pluggable. I have tried to understand how pluggability can be achieved in JSF but haven't found a clear solution.
    I would like the application to be packaged as a war file. Adding customer specific pages/bean classes to the war file and repackaging of the war is not an option. The customer specific pages/classes must reside outside this war. At runtime, based on configured rules, I need to load the customer pages and render them. If the pages are JSP based JSF pages, then they will also have their associated backing beans.
    Given that the backing beans must be preconfigured as managed beans in the faces-config.xml file and all JSP pages must be part of the packaged web application, I don't know how to go about doing this.
    A solution (non-ideal) that I have thought of is to have the customers design their forms as HTML pages and have them put these forms in the document root directory on the app server. The customer code that manipulates the data on the form will be packaged in a jar file. The HTML form 'action' will be set to a URL that will take them to one of my servlets. The interaction will be such:
    1. A user visits my JSF/JSP page. He clicks on a button. In the action event listener, I decide on the correct html form to forward the request to. I put the instance of the backingbean class in the HttpSession and forward the request to the HTML page.
    2. The browser displays the HTML form. The user enters data on the form and submits it. The request arrives at my servlet.
    3. My servlet instantiates the appropriate customer class (using the ClassLoader) and calls a method on it passing it all postdata; the method returns some String value. The servlet pulls out the backingbean class instance from the HttpSession and calls a setProperty(String value) on it. The servlet then gets a handle to the RequestDispatcher and forwards the request to my original JSF/JSP page.
    4. The JSF page is rendered in the browser with then new value (property set by the servlet) displayed in the right view component.
    The above approach is very messy and with many customer forms and backend classes this approach can get very ugly. I am looking for the correct solution that is recommended by JSF to achieve this kind of pluggability.
    Any thoughts, advice or feedback will be very appreciated.
    thanks,
    tsc

    I have researched my issue online for quite some time and have found nothing that jumps out except one post to this forum.
    Adam.Winer replied to a similar post on this forum over a year ago where he suggests replacing the ViewHandler, NavigationHandler and VariableResolver to be able to plugin JSP pages at runtime (See below).
    After doing some reading, I understand the function of the NavigationHandler and VariableResolver a bit better. do not understand how to replace the ViewHandler and what the new handler should do to render different JSP pages at runtime.
    Has anyone tried this approach. If yes, examples would be nice.
    I'm sure what I'm attempting has been done before many times. How have people gone about to achieve this kinda of pluggability in JSF.
    Anyone?
    From: http://forum.java.sun.com/thread.jspa?forumID=427&threadID=524937
    Re: dynamic configuration for the application
    adam.winer Registered: Dec 23, 2003 12:00 AM      May 24, 2004 9:30 PM
    A lot of what you're seeing are genuine limitations, but happily, JSF is so pluggable that you can overcome them.
    JSPs are problematic in exactly the way you describe - unless your app server has support for pulling JSPs out of a database, etc., you're SOL. JSF, however, lets you use something other than JSPs by replacing the ViewHandler. That's a fair bit of work, but it is doable.
    For navigation logic, you'd replace the NavigationHandler. As long as you're willing to write the code that can pull navigation rules from an external source, life is good.
    For managed beans, all you need to replace is the VariableResolver - again, if you can pull the rules from an external source, you have full control.
    This is all far from easy - and it's a huge amount of work for one person - but I'd imagine these pieces will become available from various sources. A core goal of JSF 1.0 was making the framework as a whole pluggable so that others can innovate on top of the framework.
    -- Adam Winer (EG member)

  • JSF 1.2 performance is not adequate

    Sun JSF developers...
    JSF 1.2 performance is not adequate.
    Here is a simple use case to prove:
    Render a table with ~100 columns and ~1000 rows (with facelets)
    (you could increase the numbers to stress test)
    using h:dataTable tag.
    You have to repeat h:column hundred times in XHTML (to create bigger
    UI component tree).
    Have a backing bean with 100 properties and JSF action which returns
    list of 1000 those beans.
    In this case there is no DB interaction, no back-end involved.
    Have your application set up with Ajax4Jsf (so it goes via its filter). You could
    also compare the results with and without it.
    Measure RENDER RESPONSE phase, and overall response time.
    Compare with JSP which renders same table from same bean.
    This is very simple test case to write and you will see that JSF in current state is really slow.
    This test could also be used to measure performance of new versions to see where they stand.
    It would be also interesting to see how render time grows with increase of
    number of columns (number of components in UI tree) (Is it linear or not?)
    How fast does it grow with the number of rows (Is it linear growth with increase of data size?)
    I believe this type of tests should be standardized before each release.
    Does JSF development team perform regular profiling of JSF RI java code?
    Running profiling for this use case could also reveal interesting things which
    could be improved.
    Regards,
    --MG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    But you have done nothing here to determine if itscales linearly or not.
    See below.
    You increase number of columns (rows) and measure
    time.
    When you draw on a chart how time grows with increase
    in number of columns (rows) you will see if it linear
    or not.
    I understand how to determine the growth rate; I was merely pointing out that you have only claimed to run one test and one cannot determine the growth rate from that.
    It would be also interesting to see how render timegrows with increase of
    number of columns (number of components in UI tree)(Is it linear or not?)
    How fast does it grow with the number of rows (Isit linear growth with increase of data size?)
    Unless you are talking about spreadsheets I doubtthese apps are useful.
    They are very useful.I bet they would be more useful as native desktop apps.
    >
    But this is besides the point; my point is that thescenario of having a large number of components on a
    page does not occur often in real applications.
    Really? You are not serious?Yes I am serious. I can see we have different perspectives here.
    >
    A much more common performance scenario is highload.
    This is separate story. I'm talking about latency of
    loading one page.
    Please do not confuse latency and bandwidth.I am not talking about bandwidth but throughput.
    >
    BTW most of the web sites have small number of
    concurrent users,
    so the most common scenario is actually exactly
    opposite.
    Low load but complex pages with lots of components on
    them.Again, I can see we have different perspectives here. My experiences are the opposite.
    >
    So your results will be much more useful if youinclude a load test on a moderately sized page. I'm
    not dismissing your original test as invalid or
    useless.
    My results are more useful than what you are
    proposing, as they help to pinpoint the cause of
    latency. You could run my test with profiler and
    investigate the root cause of it.You do not need to increase the number of components on the page to numbers beyond practice in order to determine this. It is sufficient to run profilers on average pages many times and determine where the most time is spent. In fact, your approach may result in an implementation optimized for pages with a large number of components but not for pages with a lower number of components.
    >
    My point is that the user experience is not degradedby the performance but by the poor presentation of
    information. Many web browsers to not take kindly to
    such large tables as well.
    With JSF user experience is degraded by performance.I'd like to see your numbers and the code you used.
    JSF makes it easier
    to do nicer user presentation, but performance
    suffers to degree that it is not usable in number of
    cases.
    JSF inability to generate page fast on server side
    has nothing to do with browsers.Correct; but I was talking about pages with large tables in general and why they are a bad idea for web applications. A native application is more appropriate. But this is orthogonal to the purpose of this thread.
    >
    Again, you are missing the point. Perhaps JSFperformance differs between the application servers.
    A fair and useful test will determine that. I'm not
    talking about the relative performance vs JSP here.
    If JSF does things inefficiently in its code it will
    show consistently bad results
    across all app servers. Again my test is to detect
    and pinpoint JSF inefficiencies and not app servers
    ones.
    Don't you think JSF developers would want to look for
    it first rather than investigating why it perform
    badly on some particular app server because of
    its internal reasons.I'm approaching this from the perspective of a developer evaluating whether to use JSF and which application server to use. This is very useful from this point of view.
    As far as the JSF developers go, as I noted above one does not need to scale out the number of components on the page to determine performance bottlenecks in the implementation. An average case is more appropriate.
    Also, if you are going to compare JSF to other technologies you need to try a variety of platforms for both. Some application servers might do JSP better than others. If you limit yourself to one platform you run the risk that it is skewing the comparison one way or another.

  • What is JSF and where use it

    hi!
    i dont know what is jsf and where use it
    what different from JSTL
    thanks...

    At this level a visit to JSF-Tutorials (http://www.jsftutorials.net/) might the best thing to do. Or dig into a book.
    Basically it has a different scope than JSTL.
    JSF is a presentation layer framework. Other names in that area are:
    Struts, Spring MVC, Tapestry, and many more
    JSTL is a collection of JSP-tags and therefor covers only a VERY small part of the presentation layer. And it is very far away from a framework
    hth
    Alexander

  • JSF analogous to Struts Tokens?

    Hi!
    I would like to know if there is any feature in JSF that is similar to Struts Tokens?
    My Specific requirement is :
    After filling the form (in a wizard kind of interface)the fields would be persisted , but the user might click the back button to make sure that he entered the data correctly, and then may click next
    button, which triggers a duplicate data error, because the user has already entered the data ,and that is persisted.
    In Struts we would do Action .savetokens in the submit action
    and check for the validity of the token by caling Action.isTokenValid(),if the conditions is true, thaty means the form has been already submitted.
    Like wise is there any thing that resembles this feature of Struts in JSF ?
    May be savestate and restorestate could be a solution..
    Any thoughts..?
    Regards,
    Samba

    Hi! Simon,
    From Apache trinidad Documentation :
    Some Apache Trinidad configuration options are set instead with <context-param> elements in your WEB-INF/web.xmlfile.
    org.apache.myfaces.trinidad.CACHE_VIEW_ROOT
    Enables or disables UIViewRoot caching; defaults to true.
    When "token" client-side state saving is enabled, Trinidad applies an additional optimization by caching an entire UIViewRoot tree with each token. (Care has been taken to ensure that this does not affect thread safety or session failover.) This is a major optimization for AJAX-intensive systems, as postbacks can be processed far more rapidly without the need to reinstantiate the UIViewRoot tree. However, it is known to interfere with some other JSF technologies. In particular, the Apache MyFaces Tomahawk saveState component does not work, and template text in Facelets may appear in duplicate. This optimization can be disabled by setting this context parameter to false.
    org.apache.myfaces.trinidad.CLIENT_STATE_METHOD
    Chooses the type of client-side state saving used when client-side state saving is enabled (with the JSF standard javax.faces.STATE_SAVING_METHOD parameter). Two values are accepted:
    * "token": the default, which stores page state in the session, but persists a token to the client that lets Apache Trinidad disambiguate the same page appearing multiple times. Failover is supported.
    * "all": stores all state in the client in a (potentially large) hidden form field. This matches the default behavior of the JSF reference implementation, and can be useful for developers avoiding any use of HttpSession.
    org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS
    In "token"-based client-side state saving, chooses how many tokens should be preserved at any one time. The default value is 15. When this is exceeded, state will have effectively been "forgotten" for the least recently viewed pages, which can impact users that actively use the Back button or that have multiple windows open simultaneously. Developers building HTML applications that rely heavily on frames will likely need to increase this value.
    org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE
    This configuration option enables an optimized strategy for caching some view state at an application level, which significantly improves scalability. However, it makes it harder to develop (updates to pages will not be noticed until the server is restarted), and in some rare cases cannot be used for some pages. See below for more information about this option.
    What i'm interested in knowing more about is this :
    We can get the token written to the Web page as a ViewState hidden variable by calling facesContext.saveState();
    Can we use this token to Compare whether the user has already submitted a request, and identify that he now posting a duplicate request?
    I'll give it a try,any way.
    And coming to your suggestion of using pageFlowScope ----
    We regularly use that to save a flag which is set to true on form submission ,and corresponding persistence ,and later if the user clicks the back button,and submits the form again, we'll check for the flag ,and since the value is true, we would silently continue with the decision to move to the next page this time leaving out persistence;unless ,of course in the scenario where the form fields might have changed in the second submission of the form in which case , we need to update the values that have already been entered ... and this involves a lot many issues to discuss ,than mentioned here.
    but my intention is to know whether there is an in-built functionality in JSF that addresses this issue as did the Struts!
    I strongly believe that viewState Token should be a very good candidate for this feature.
    Am I too idealistic ?
    Any thoughts are welcome,
    Regards,
    Samba

  • Valuelist and jsf

    I trying to display large volume of search results (1000-3000 rows) on my JSF page. And here are my options:-
    1.DisplayTag and JSF
    http://displaytag.sourceforge.net/11/DisplayTag is a popular candidate. Matt Raible has posted an example http://demo.appfuse.org/appfuse-jsf/users.html example of JSF-DisplayTag integration. But I read somewhere that the performance degrades and the page takes more than 40 seconds to load when there are more than 5000 search results. It makes sense, as the search results are stored in the session in this approach.
    2.ValueListHandlerTag and JSF
    This http://valuelist.sourceforge.net/tutorial.htm tag uses the ValueListHandler J2EE pattern. But I could not find any examples of how to integrete this with JSF. Has any one tried this before?
    3.Custom JSF Compoenent
    Similar to the option above. Except that it would involve me writing a custom jsf component that uses the ValueListHandler pattern (call a stateful session bean to fetch the rows for the current page).
    4.MyFaces DataTable
    http://www.irian.at/cagatay-validation-sandbox/selectOneRow.jsf
    Havn't used this before. Is it any good?
    So, these are the options I have. Any suggestions..
    Message was edited by:
    Mike.Corleone

    Who on earth would read the 3000 rows at once? Google doesn't show billions webbpages at once in the same page, do they?
    Implement filtering (searching) and/or paging techniques. Showing 100 rows at once is far more than enough. You may get useful ideas out of this: [http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html].
    That said, in the future please do not resurrect old topics. Start your own topic for each independent problem. If you feel the need, you may always link to any old topic you found in your query.

  • Security with jsf

    Hello,
    my website has 5 roles groups and each one can access to differents pages.
    How can i forbid the access to pages of the role group 1 to the others?
    In fact, a bean has a "level" variable which contain the role group of the user.
    I would like to test this value and if it is the good one, give access.
    Otherwise, i would like to redirect the user to the login page
    Thx u in advance !
    PS: All is made with JSF

    Hi
    Put this in Ur web.xml
    <filter>
              <filter-name>SecurityFilter</filter-name>
              <filter-class>adjuvant.poa.util.SecurityFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>SecurityFilter</filter-name>
              <url-pattern>*.jsf</url-pattern>
         </filter-mapping>
    here is ur security class
    adjuvant.poa.util.SecurityFilter
    * [email protected]
    package adjuvant.poa.util;
    import javax.servlet.Filter;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.FilterChain;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.Set;
    import java.util.HashSet;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import adjuvant.poa.jsf.backingbeans.UserBean;
    * This Filter class handle the security of the application.
    * <p>
    * It should be configured inside the web.xml.
    public class SecurityFilter implements Filter {
         //the login page uri
         private static final String LOGIN_PAGE_URI = "login.jsf";
         private static final String ADMIN_LOGIN_PAGE_URI = "../login.jsf";
         private static final String USER_BEAN = "nurse";
         //the logger object
         private Log logger = LogFactory.getLog(this.getClass());
         //a set of restricted resources
         private Set restrictedResources;
         * Initializes the Filter.
         public void init(FilterConfig filterConfig) throws ServletException {
              this.restrictedResources = new HashSet();
              this.restrictedResources.add("/assessment.jsf");
              this.restrictedResources.add("/patients.jsf");
              this.restrictedResources.add("/anesthetic.jsf");
              this.restrictedResources.add("/baseline.jsf");
              this.restrictedResources.add("/drugs.jsf");
              this.restrictedResources.add("/endocrine.jsf");
              this.restrictedResources.add("/haematological.jsf");
              this.restrictedResources.add("/labwork.jsf");
              this.restrictedResources.add("/medication.jsf");
              this.restrictedResources.add("/neurologocal.jsf");
              this.restrictedResources.add("/newpatient.jsf");
              this.restrictedResources.add("/patientdetails.jsf");
              this.restrictedResources.add("/renal.jsf");
              this.restrictedResources.add("/respiratory.jsf");
              this.restrictedResources.add("/riskassessment.jsf");
              this.restrictedResources.add("/summary.jsf");
              this.restrictedResources.add("/minimalquestions.jsf");
              //admin Pages
              this.restrictedResources.add("/admin/admin.jsf");
              this.restrictedResources.add("/admin/drugs.jsf");
              this.restrictedResources.add("/admin/drugs.jsf");
              this.restrictedResources.add("/admin/editdrugs.jsf");
              this.restrictedResources.add("/admin/nurses.jsf");
              this.restrictedResources.add("/admin/newnurse.jsf");
              this.restrictedResources.add("/admin/transaction.jsf");
         * Standard doFilter object.
         public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                   throws IOException, ServletException {
              this.logger.debug("doFilter");
              String contextPath = ((HttpServletRequest)req).getContextPath();
              String requestUri = ((HttpServletRequest)req).getRequestURI();
              this.logger.debug("contextPath = " + contextPath);
              this.logger.debug("requestUri = " + requestUri);
              if (this.contains(requestUri, contextPath) && !(requestUri.contains("admin") ? this.authorizeAdmin((HttpServletRequest)req) : this.authorize((HttpServletRequest)req))) {
                   this.logger.debug("authorization failed");
                   ((HttpServletRequest)req).getRequestDispatcher(LOGIN_PAGE_URI).forward(req, res);
              else {
                   this.logger.debug("authorization succeeded");
                   chain.doFilter(req, res);
         public void destroy() {}
         private boolean contains(String value, String contextPath) {
              Iterator ite = this.restrictedResources.iterator();
              while (ite.hasNext()) {
                   String restrictedResource = (String)ite.next();
                   if ((contextPath + restrictedResource).equalsIgnoreCase(value)) {
                        return true;
              return false;
         private boolean authorize(HttpServletRequest req) {
              UserBean user = (UserBean)req.getSession().getAttribute(USER_BEAN);          
              if (user != null ) {
                   //user logged in
                   return true;
              else {
                   return false;
         private boolean authorizeAdmin(HttpServletRequest request) {
              UserBean user = (UserBean)request.getSession().getAttribute(USER_BEAN);
              if (user != null && user.getUserId() != null && user.getUserId().equals("admin") ) {
                   //user logged in
                   return true;
              else {
                   return false;
    }

  • Which application servers are supporting JSF Technology

    please let me know which application servers are supporting Java Server Faces Technology, and shall i use the combination of JSF with EJB. if so how can i do?

    Hi Varam99,
    I doubt you will get an official word on who is supporting but you can look at the list of participants in the expert group and get a good feel for who is interested.
    As far as using JSF with EJB's you should look at http://www.corej2eepatterns.com/Patterns2ndEd/BusinessDelegate.htm -- the business delegate pattern. I have also posted several times here on this list WRT this issue of accessing business logic from your JSF application. You can search on 'accessing business logic'.
    I also posted a presentation I gave at the http://www.nofluffjuststuff.com -- Chicago event. You can see the slides on my blog @ http://bill.dudney.net/roller/page/bill/20030917#jakarta_pitfalls_real_world_jsf.
    Hope this helps.
    TTFN,
    -bd-
    http://bill.dudney.net

Maybe you are looking for