Mixing JSF1.2 and JSF2 - jsf-2

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

Related

Struts 1 or Struts 2 . Which one is advisable for web application development?

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...

Cannot create a session after the response has been committed - PrettyFaces MultiPageMessagesSupport on Glassfish4

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);

Is PrimceFaces 3.1 Backward Compatible to 2.x version

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.

.NET MVC + Dojo (Other Framework) for mini-ERP

We are about to develop a mini-ERP web-app. We need the app to be browser agnostic with rich user interface which should be 'enterprise-ready'!. Something like the latest openERP.
We are planning on using the .NET MVC 3 and Dojo for our project.
So our major queries are:
Are there any Htmlhelpers for Dojo. Any opensource implementation where we can get some idea.
Will the app be slow if we use Dojo? In our previous project we integrated Dojo with PHP and had to make the web-app SPA (single page application). This is because on each request, the declarative markup was processed by dojo. So larger the no. of widgets, longer the processing. We had not tried the Dojo build feature then. Will that make it fast? Or do we have to go with the Single Page Application? What are the pro/cons of SPA?
Note: We are open to using any other competitive JS Framework. Bonus point if we get some ready implementation with .NET MVC (for reference).
I have developed ERP application using ASP.NET MVC 2. It is not so advanced but it gets the job done.
Here are some points concerning its implementation:
It is not SPA
For the UI I have used jQueryUI and jqGrid, which perform very well
AJAX form submission using jQuery Form Plugin
We are using ASP.NET MVC4 in our ERP project. These features are related with the architecture .
JQuery Layout
SlickGrid (a open source grid control with very rich functions and plugins)
ZTree
JQuery Dialog
WebApi (not WCF)
Dapper (not EntityFramework)
We combine many plugins working together, and one team member is familiar with CSS and DIV layout. There are some challenges if you haven't rich experience with javascript and UI layout. Finally, we have completed the project, it is amazing.

Using Struts2 in NetBeans6.9

Im newly using Struts2 now,but previously i used to work with Struts1.3.While using struts2 with netbeans6.9 IDE i'm facing problem.Actually i want to know what's the real difference between struts1&2 on implementation?.Is there any difference between them in the development?
Perhaps this thread will help: Struts 1.x vs Struts 2.x

Resources