aspose file tools*
The moose likes JSP and the fly likes JSF: Where do the technologies fit in? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSF: Where do the technologies fit in?" Watch "JSF: Where do the technologies fit in?" New topic
Author

JSF: Where do the technologies fit in?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

I've had zero time to look into JSF to date. Could you give a brief overview of the technology? For example, how does it fit onto the HTTP request/response cycle? Does it (or how does it) utilize the servlet model? What processing happens where? Is it a JSP replacement or augmentation?
You also mentioned a navigation model in other threads; could you give a stratospheric view of how that operates?
thanks,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bill Dudney
Author
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
Hi Bear,
JSF is a Model 2 framework for doing web development. Which is just a fancy way to say that JSF does model-view-controller for the web. I have a bit of info about this in the presentation I did for NoFluffJustStuff. If you search on google you should find it on either my blog or my .mac account.
So the lifecycle looks something like this.
  • You click a button or a link
  • Server gets the form submit via normal HTTP stuff
  • Server sees the JSF tags in the URL (either /faces/* or *.jsf or something of your choosing) that says to forward the request to the FacesServlet.
  • FacesServlet does a bunch of stuff to get your components up and ready for events
  • Your application is called a well defined points in the processing
  • The logical outcome from the processing is matched against the nav rules (more on that latter)
  • JSF forwards to the page specified in the nav rules


  • From the 100000 foot range (stratosphere starts about there if I remember my earth science ) the navigation model lets you externalize the way users navigate through your application. So for example here in my Post A Reply form on JavaRanch there are two actions I can take, 'log out' and 'Add Reply'. If I were implementing this form with JSF these two 'actions' are UICommand components. One rendered as a link and one is rendered as a button. When the button click happens or the link is activated the form is submitted. On the back end the JSF machinery notices what happened and posts server side events. The events eventually boil down to a method call on one of the server side objects to a method that returns a String and takes no arguments. This string is called a 'logical outcome' in the spec. This logical outcome is then matched against the navigation rules in the faces-config.xml file. The rules basically say 'from some page with logical outcome XYZ go to page Foo.jsp'.
    I hope that helps!


    TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15286
        
        6

    That was a good explination. It's a lot like Struts. But as I understand from another post, it is Component driven whereas Struts is, well, I don't know what it is.


    GenRocket - A Test Data Generation Platform
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60053
        
      65

    Cool, that answers the nav question pretty well, thanks.
    What about the JSP question: Is a "JSF page" a JSP page with JSF-provided custom actions? Or does JSF replace JSP with another templating language?
    Bill Dudney
    Author
    Ranch Hand

    Joined: Sep 05, 2003
    Posts: 234
    I'd call Struts 'custom action' based. Every bit of UI in struts is based on the tags.
    JSF uses JSP for the default templating language. However one of the examples that ships with RI shows you how to build the component tree (the view) with XML.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JSF: Where do the technologies fit in?
     
    Similar Threads
    "Re-Object Class"
    NX: Where TableModel goes? -- Client GUI
    Mark's MVC design - all controller methods private?
    is Seam just another framework?
    Opening new email item in plain text format using Java