This weekend, when my wife took her naps, I did some JSF 2.0 stuff…mostly getting a platform up and running on my work laptop that would allow me to write some JSF 2.0 code and perhaps have something to show y’all.
I have done this setup before on other machines, but I tried some different things.
I recommend the following download: http://netbeans.org/downloads/ (pick the “Java EE” download).
If you do this you get the netbeans IDE, and it will also install (optionally…you have to select a checkbox to install it) glassfish server 3.x. This version of Glassfish is Java EE 6 certified. And this version of Netbeans is integrated pretty well with Glassfish, even with regard to JSF 2.0.
If I do examples I will do it with these two. So if you want to reproduce whatever I will be able to give you specific advice.
I have used this combination of IDE and web server before for JSF 2.0, and it was recommended by the Burns and Schalk JSF 2.0 book that I read.
That said…I DID find a really good JSF 2.0 tutorial: http://www.coreservlets.com/JSF-Tutorial/jsf2/
This tutorial seems to have been put together really recently. They use eclipse Helios and Tomcat 7. I think this combination would be pretty easy to get started on as well, as Eclipse appears to have some decent support for Tomcat. However I would not recommend Eclipse/Glassfish combination, because the latest version of Eclipse’s Glassfish server adapter seems to have a bug or two…at any rate: figuring this particular problem is really not my top priority right this second, so I did not pursue this problem to the ends of the earth…just partway around the earth :-)
This site promotes and supports the development and deployment of JSF, Oracle ADF applications, and other web development topics. If you have interesting facts to share about any of these or any related technologies, please feel free to post a comment.
Tuesday, July 5, 2011
Thursday, February 3, 2011
My new JSF 2.0 presentation
Well it is done...ish.
I have put a copy of this presentation on slide share, the link for which is here ; you can also see my other papers by using the link on the right side of this blog, in the section for resumes and presentations.
This presentation is also available in slideshare for download, in Powerpoint and PDF format.
Enjoy.
I have put a copy of this presentation on slide share, the link for which is here ; you can also see my other papers by using the link on the right side of this blog, in the section for resumes and presentations.
This presentation is also available in slideshare for download, in Powerpoint and PDF format.
Enjoy.
PDF What's new with JSF 2.0
.
View more documents from Michael Fons.
Labels:
JSF 2.0,
JSF 2.0 New Features,
presentation
Monday, January 31, 2011
Yes, but WHAT IS A CONTROLLER??
I asked Simon Lessard (a guru among gurus for Java and ADF) in the ADF Methodology Group about what he thought a controller was, and his response is of great interest to me; so I am going to publish it.
From it I learned that Struts did not use the event model, what an Observer pattern was, and a better way to organize your backing bean (controller bean/data bean) code.
From this thread, we have the following:
From it I learned that Struts did not use the event model, what an Observer pattern was, and a better way to organize your backing bean (controller bean/data bean) code.
From this thread, we have the following:
Hi Michael,
It depends, "controller" can have many meanings. In the purist version, the MVC model is a triangle (http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller). The model exposes the data and services, the controller is the one in charge of calling the model, and the view represents it, calling the controller whenever a UI event occurs and observing (observer pattern http://en.wikipedia.org/wiki/Observer_pattern) the model layer for change and updating itself if something happens.
Now, since the Web model is a detached one, that last interaction is not possible so the MVC model in the Java web world is a mutation of the pure one. As of Struts, the controller was defined as the component in charge of managing the page flow, the navigation of which was implemented by two type of entities, the Action and the struts-config.xml file (and the control flow engine running it). With JSF, the event model like that of Swing was added, providing a way to implement another part of the controller layer -- the UI event management -- through various listeners. Each listener can therefore be considered a controller or part of a bigger controller (depending how you implement it) since these listeners can modify the component (refresh it, change its state, etc.). Also, since those listeners are accessed through EL and call managed bean methods in the end, then yes, I consider some managed beans a controller (or a part of a controller) -- but only if they are not used to store data. I call the latter data beans, and they often implement an interface from the model layer so that they can be used as service call parameters. So, in the pages, you have:
<af:inputText value="#{expressionToADataBeanField}"/>
<af:commandButton action="#{expressionToAControllerBeanMethod}"/>
<af:someComponent binding="#{expressionToAControllerBeanField}"/>
Since the controller bean often needs access to the data bean, I inject the data bean into the controller bean (using the managed-property feature of JSF) when the controller is created. The data bean is stored in a persistent scope like session or page flow and must therefore be Serializable. The controller bean, on the other hand, must be stateless; so it can only be placed in the backing bean or the request scope and cannot be Serializable since UIComponent (the root class for components) isn't and can be bound in the bean.
So yes, I call a backing bean a "controller" since they manage the UI interactions, call the model layer services and participate in the navigation through the action's outcome which is everything a controller should do. However, the controller layer is also completed by the JSF's NavigationHandler, which takes care of the actual page flow from the outcomes.
So to summarize, I consider:
- Managed beans used to bind components and deal with events: backing beans, controllers, controller beans
- Managed beans used to store the data entered by the user: data beans, page flow beans, session bean
I hope it clarifies the concepts a bit,
~ Simon
Labels:
ADF Faces 11g,
Controller,
JSF,
managed beans,
MVC
Thursday, January 27, 2011
Backing Bean Scope
What is a key difference between JSF request scope and ADF backing bean scope?
Well, the "lifetime" of these two scopes is exactly the same. However if you need to create a backing bean for an ADF declarative component, the you will need to use backing bean scope for that managed bean. This enables using multiple instances of your declarative component in a single ADF page...something which the JSF request scope does NOT support.
(Please see the comments on this blog entry for an additional function of Backing Bean Scope as relates to regions and bounded task flows; many thanks to Chris Muir for pointing these things out.)
Well, the "lifetime" of these two scopes is exactly the same. However if you need to create a backing bean for an ADF declarative component, the you will need to use backing bean scope for that managed bean. This enables using multiple instances of your declarative component in a single ADF page...something which the JSF request scope does NOT support.
(Please see the comments on this blog entry for an additional function of Backing Bean Scope as relates to regions and bounded task flows; many thanks to Chris Muir for pointing these things out.)
Labels:
ADF Faces 11g,
backing bean scope,
JSF request scope
Wednesday, January 26, 2011
Refresh Data Controls in JDeveloper 11g
If you are looking on your ViewController project and you do not see new columns you have added to your business components, press the refresh icon on your Data Controls pane. It is very important...this is not just a convenience...to hurry something along that just has not happened yet in the due process of polling or whatever other triggers might be used in the inner sanctums of JDeveloper. This refresh action is more like, the View does not even recognize the changes until this refresh button is pressed.
Perhaps it is just the way I am using JDeveloper, but this seems to be a very helpful thing to know, if you are used to JDeveloper 10g.
Perhaps it is just the way I am using JDeveloper, but this seems to be a very helpful thing to know, if you are used to JDeveloper 10g.
Thursday, January 20, 2011
JSF 2.0 observations on JavaScript format for Ajax
I notice that on the version of JSF 2.0 I have on GlassFish, that the jsf.js page may not be included to make a call to jsf.ajax.request(), if you need access to this function. I guess in that case you would either add a do-nothing f:ajax tag to your JSF file, or do some include of the jsf.js library programmatically. The former option may be better.
Also I noticed that if you want to key in on a non-default event when calling jsf.ajax.request() that you will need to create an object for the last parameter that includes the property javax.faces.behavior.event...but be careful: you will get a JavaScript error if you try to do this all in line without some extra work. Property names typically do not have periods in them ("."). So you have to do something like the following:
Also I noticed that if you want to key in on a non-default event when calling jsf.ajax.request() that you will need to create an object for the last parameter that includes the property javax.faces.behavior.event...but be careful: you will get a JavaScript error if you try to do this all in line without some extra work. Property names typically do not have periods in them ("."). So you have to do something like the following:
...onkeyup="var lArgs = {}; lArgs['render'] = 'form:output'; lArgs['javax.faces.behavior.event'] = 'keyup'; jsf.ajax.request(this,event,lArgs);"
Labels:
f:ajax,
JavaScript object properties,
JSF 2.0,
jsf.js
Subscribe to:
Posts (Atom)