I'm developing a web app using JSF 2.0 + PrimeFaces 2.2.1
Now I think PrimeFaces 3.x is stable enough. (3.1)
Can I replace the library (PrimeFaces jar file) and continue the development. I know some features have been re-invented in PrimeFaces 3.1.
Will this change make any problem to my app?
You can find the main changes in PrimeFaces 2.2 --> 3.0 in the PrimeFaces wiki. Here's an extract of relevance:
General Changes
Taglib namespaces are changed as;
http://primefaces.prime.com.tr/ui -> http://primefaces.org/ui
http://primefaces.prime.com.tr/mobile -> http://primefaces.org/mobile
Note that this change applies 3.0.M4 and newer.
Component events are now decoupled and implemented as ajax behaviors to improve flexibility. Read more at here. Common *Listener and *Update attributes are now removed, an example is rating component;
2.x;
<p:rating value="#{ratingController.ratingValue}" rateListener="#{ratingController.handleRate}" update="messages"/>
3.x;
<p:rating value="#{ratingController.ratingValue}">
<p:ajax event="rate" listener="#{ratingController.handleRate}" update="messages" />
</p:rating>
User's guide and Taglib docs(IDE completion) will provide all the available events of a component.
RequestContext now allows to execute javascript from backing beans (e.g. deciding to keep a dialog open or hide it), In 2.x this conditional javascript execution on callbacks like oncomplete are achieved via callback params, execute("script here") makes it very easy to implement the same compared to callback params. Note that callback params are still supported and will be in future as they are also used internally in PrimeFaces.
Tag/Attribute docs are available again in facelet taglib to take advantage of quick documentation via IDE code completion.
Aristo replaced Sam as the built-in theme, sam is available at theme gallery as a downloadable theme.
You can find the main changes in PrimeFaces 3.0 --> 3.1 in this PrimeFaces blog. Here's an extract of relevance:
Backward Compatibility
There are two points to note regarding backward compatibility with 3.0;
Component referencing is now aligned with JSF Spec, if PrimeFaces cannot find a component, it will throw an exception. Since PrimeFaces 2.2 we’ve been logging an info message that component cannot be found and falling back to the client id. If you haven’t ignored these messages and fixed your code since 2.2, there won’t be a problem. If not, you need to update your component referencing with respect to findComponent specification.
primefaces.THEME_FORMS setting is removed in favor of plain css, if you need to reset the theme aware styles on input components, add a reset css instead.
Related
I have upgraded my application from orbeon 4.4 to orbeon 4.7. On loading forms, in the browser console I'm getting $.browser is undefined.
On debugging I found that orbeon 4.7 is using jQuery v1.11.0 and $.browser is removed from jQuery v1.9.
Any idea why it is still using removed/deprecated $.browser??
How to solve this??
Per the jQuery documentation, "This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.". So you could:
Add the JavaScript for jquery-migrate to your project.
Change your code to check whether the feature you want to use is available, rather than rely on knowing in which browser it is available. (Most front-end developers would recommend you try to use this first.)
I am little bit confused to choose Struts 1 or Struts 2 for my new web application development assignment. Could any one suggest me which framework should I use for development from architecture point of view? What are the points I should take care of to choose the struts version before I go for development of the application?
Any help will be appreciated.
Hi I prefer struts 2 because,
Struts 1.x
In struts 1.x front controller is ActionServlet
In struts 1.x we have RequestProcessor class
In struts 1.x we have multiple tag libraries like html, logic, bean..etc
In struts 1.x the configuration fine name can be [any name].xml and we used to place in web-inf folder
In struts 1.x we have form beans and Action classes separately
In struts 1.x an Action class is a single ton class, so Action class object is not a thread safe, as a programmer we need to make it as thread safe by applying synchronization
In struts 1.x we have only jsp as a view technology
Struts 2.X
In 2.x front controller is FilterDispatcher
In 2.x we have Interceptors instead RequestProcessor
In 2.x we do not have multiple libraries, instead we have single library which includes all tags
In 2.x the configuration file must be struts.xml only and this must be in classes folder
In 2.x form bean, Action classes are combinedly given as Action class only, of course we can take separately if we want
In 2.x an Action class object will be created for each request, so it is by default thread safe, so we no need to take care about safety issues here
In 2.x we have support of multiple view technologies like velocity, Freemarker, jasper reports, jsp.
Since you have mentioned that it is going to be a new web-application,Just go with Struts2.Struts1 has already in EOL which means there will be no loner support for the Struts1.
Also Struts2 is a new and very flexible framework and will provide you a lot more control.Here are
Choose latest version of Struts2 to start work with (2.3.15.1)
If you are planning to write your service layer in Spring, you can use Struts2-spring plugin to let spring DI manage struts2 component for you.
Since you seems new to Struts2, i suggest to pay special attention to OGNL which is a core building block in struts2 and you will going to use it a lot in your Tags at UI.
Struts2 has a very flexible plug-able architecture which let you to create as well use many plugin which can save your time to build functionality from start.
Hope this might help you.Additionally You can review and look in to other MVC framework also
I also prefer going with Struts2 itself rather than Struts1 because Struts1 is old and its EOL has been announced on September 1, 2013 with the message "the Struts 1.x web framework has reached its end of life and is no longer officially supported."
[Source:- wikipedia.org]
So it is better to go with Struts2[i have been using version:-2.3.1.1 as I faced some "Dispatcher error"(jar files in the package were not compatible with each other) issue while using 2.3.16 version]
Hope this might help.
I've had a similar dilemma as you do, but instead of going with Struts, I've chosen Tapestry after some consideration.
Some of its awesome features are
Pages as POJOs
Really good dependency injection
Scalable
Easy to learn with lots of examples
much more...
The legacy web app is using JSF1.2 with facelets. Due to the size of the app, upgrading it to JSF2 would take extensive effort. Is it possible to mix JSF1.2 and JSF2 in the same web app during the transition period?
I read this post: Mixing JSP and XHTML (Facelets) in JSF2 Project - possible?
but it seems to be related more to converting a JSP app to JSF2?
Thanks for any help.
Is it possible to mix JSF1.2 and JSF2 in the same web app during the transition period?
No.
You can mix JSP and Facelets in one web application, but you can definitely not mix different JSF impls/versions in the same web application. It would only result in class loading conflicts in all colors because multiple different versions of the very same classes are then present in the runtime classpath.
See also:
Migrating from JSF 1.2 to JSF 2.0
I have a Java EE app where I use JSF2 + PrettyFaces + EBJ3 + Glassfish
I just recently updated to Glassfish4 which is the default Server implementation for Java EE 7 and I started getting issues with PrettyFaces.
I have configured on my faces-config.xml:
<lifecycle>
<phase-listener>com.ocpsoft.pretty.faces.event.MultiPageMessagesSupport</phase-listener>
</lifecycle>
to enable for Faces Messages to be passed around correctly and displayed on screen.
But since I upgraded from Glassfish3 to 4 I started getting this issue:
java.lang.IllegalStateException: Cannot create a session after the response has
been committed
...
at com.ocpsoft.pretty.faces.util.FacesMessagesUtils.saveMessages(FacesMe
ssagesUtils.java:56)
at com.ocpsoft.pretty.faces.event.MultiPageMessagesSupport.afterPhase(Mu
ltiPageMessagesSupport.java:66)
If I remove the listener from faces-config.xml none of the Faces messages are displayed on screen.
I am using PrettyFaces to have nice well formatted URLs to enhance SEO on my site. I wish I couldn't have to replace it or refactor my app to not use it since I already mapped a lot of the navigation flow using it. Does somebody know a better option for this scenario?
I really appreciate any suggestions. Thanks.
I don't recommend to use MultiPageMessagesSupport if you are deploying to a "modern" container with JSF 2.2 support. The MultiPageMessagesSupport phase listener has been developed for JSF 1.x. JSF 2.x added support for persisting messages across redirects. Just execute this code before redirecting:
FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
I have a project which is developed by Primefaces 2.2 and JSF 2.1.
Since I am not satisfied with Primefaces' template neither ThemeRoller that they provide, I found very interesting themes on
http://themeforest.net
and I want to integrate one of those in my project.
Is it possible to integrate Primefaces with templates from Themeforest? Are there any traps that I need to consider?
Primefaces themes are powered by theme rollers, (separate css for structure and skinning). the only way of implementing themes is by using Primefaces's template or ThemeRoller. Or else you can try dynamic themes by defining EL expression as a param value
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{themeSwitcherBean.theme}</param-value>
</context-param>
as mentioned in primefaces document here http://www.primefaces.org/documentation.html
Yes, of course, but it's not a template. It's a theme. You can do that easily with facalet.
I never use the template / skinning provided by Primefaces, but sometimes integrate it in the project because there are some very useful components. Of course you can use a custom template like those you saw on Themeforest. All you have to do is create XHMTL instead of HTML files and correct some syntax (for example input tags need a closing tag in XHTML). The problem is you can't completely disable the styling of components like the p:inputText, you have to use h:inputText and then apply the classes provided by your template in the styleClass attribute.