When and why we use the verbatim in jsf? - jsf

As i am now working on jsf i want to know why we use the tag verbatim in jsf and what is the significance of it ?
Any help would be of great appreciation.

Since you've tagged your question with jsf-2 the answer is: you shouldn't use it.
It is deprecated in JSF 2.0. It was a part of JSF 1.X and used to hold plain HTML. See also this answer, the docs (since 2.1 there is an additional info: The use of this element has been deprecated in Facelets for JSF 2.0 and beyond) and the usage example.

Related

JSF 2.2 displayValueOnly

Is there a possibility to use the option "displayValueOnly" (https://wiki.apache.org/myfaces/DisplayValueOnly) with JSF 2.2?
I think the link above is explaining the feature of Tomahawk which exists only for older JSF versions, right?
Is there a alternative for creating a read and edit mode without creating two elements and without using "readOnly" or "disabled"?
Thank you!
Tomahawk is not compatible with JSF 2.2 - I've tried a few components and they work fine for others you've to work on the Tomahawk source.

Managed bean annotation is stricken out (crossed by a line)

I have a problem when trying to use
#ManagedBean, it appears like this :
#ManagedBean,
Check the image below :
here is a photo of the code
Yesterday, I could create a project and use it, but today I cannot, I don't know what happened , maybe because I changed GlassFish 4 to 5 , and PostgreSQL 9.3 to 10?
EDIT: I tried to see my others project, and they are all stricken out in #ManagedBean.
The crossed line (aka "strikethrough") on a class, method, or annotation means that it has been deprecated by the author and you should no longer use it. If you mouse over the annotation, it should give you some sort of explanation as to why it was deprecated, and what you should use instead.
In this case, the JSF #ManagedBean annotation was "strongly discouraged" in JSF 2.2, and officially deprecated in JSF 2.3 (hence the strikethrough in your IDE). Instead, you should use the #Named annotation which is provided by CDI and is a more standard way of creating a bean in Java EE.

Are RichFaces 3.3.3 and JSF 2.1 going to work fine together?

Currently I'm using JSF 1.2 and RichFaces 3.3.3 and they work fine. But am I going to have to update my current RichFaces version up to 4.x and make the changes, coprresponding to the migration guide if I decide to update my JSF version up to 2.1.29. I mean are there components which are not going to work appropriate or ever work at the JSF 2.1.29 + RichFaces 4.x(4.5.2 in particularly) combination. I mean components like a4j:keepAlive which I think should be replaced with something else.
Basically they are going together but with some limitations, because RichFaces 3.3.3 does not support some JSF 2 functionalities like built-in facelets (VDL), Bean Validation (JSR-303), JSF 2 afax functionality, ... see here.
But there are some workarounds to get over the limitations...
The problems you will depends strongly on the used Richfaces Components in your project.
If you want to use JSF 2 (2.0, 2.1, 2.2) and its benefit, I would consider also updating to RichFaces 4 (4.0, 4.1, 4.2, 4.3, 4.4, 4.5) in order to get all the benefits from JSF 2. You need to investigate time for both solutions. But if you go with RichFaces 4, future changes will be more efficient I think.
If you decide to stay on Richfaces 3.3, I would consider update the version to 3.3.4 which consists of a security patch applied to the 3.3.3.Final release and which introduces basic JSF 2 support to the 3.3.X branch.

Omnifaces: Using CombinedResourceHandler with Richfaces

when using CombinedResourceHandler in a Richfaces application only stylesheets and user defiend scripts are combined. The standard JavaScript resource and all Richfaces specific resources remain as seperated resources.
The Omnifaces documentation states:
RichFaces has the same problem with several JS files, but this is so far not exactly trivial to workaround
So my question is what this 'non-trivial workaround' would be?
As far as I can see, CombinedResourceHandler wont handle resources when getRendererType() returns org.richfaces.renderkit.ResourceLibraryRenderer. These are then handled by org.richfaces.renderkit.html.ResourceLibraryRenderer.
I am not sure what would be the best way to combine RichFaces behaviour with OmniFaces here.
I was able to create a solution by modifying OmniFaces CombinedResourceHandler.
Details in short:
Richfaces utilizes a concept called ResourceLibrarys wich means a resource may not only be a single file but instead a collection of those files. For example, RichFaces uses a resource named base-component.reslib. RichFaces ResourceHandler interpretes this resource dependency as dependency to
javax.faces:jsf.js
jquery.js
richfaces.js
richfaces-base-component.js
So the CombinedResourceHandler needed some extra functionality to seperate dependencies to ordinary Resources from Richfaces ResourceLibraries. The latter needed to be resolved according to specifications obtained from RichFaces sources.
It was not trivial to work this around without modifying the CombinedResourceHandler itself. The CombinedResourceHandler itself has really to be modified to use a reflection hack which extracts the resources from RichFaces' org.richfaces.resource.ResourceLibraryFactoryImpl. The reflection hack is necessary in order to keep OmniFaces free of RichFaces dependencies so that it can be used together with other component libraries like PrimeFaces.
As per issue 107, this was implemented in 1.3-20121206.

Can someone explain facelets?

I have been involved in JSF + Facelets dev for a month or so. I used composition, insert, define and other tags from facelets. I am finding it difficult to understand what facelets really give me? What are its alternatives ? What is that View Handler technology?I am not able to find good material / online notes on the same. Can someone explain in laymen terms - What it is? Thanks
Facelets is a view technology. Facelets is the successor of JSP. The only alternative as far is JSP, which has almost no seamless support for JSF components. If you leave Facelets aside and step back to JSP, then the real advantages of Facelets will be quickly clear.
You may find my answer in the question useful as well: What is the difference between JSF, Servlet and JSP? Facelets is also covered in there.
Without providing a complete academic background on Facelets, here's what it really gives you:
First, the ability to create reusable HTML code that you write yourself: this is not possible with JSF (pre-v2). Facelets gives you more control over the output of your webpages.
It has been demonstrated in some editors you can preview parts of
your page this way as well, but in reality this is impractical as the
webpage has many states of which only the initial bare version would
be visible in the preview.
If you are going to use JSF for a public website, Facelets are a must
for SEO, considering that with JSF you have no control whatsoever of
what comes out of the standard JSF components.
Second: templating. The ability to define blocks of HTML (read: Facelet compositions) that can be reused using tags such as ui:define and ui:insert.
There are other benefits, but right now you should know that these two are why you are using Facelets over JSF. Also, JSF 2.0 by default contains a modified version of Facelets.
benefits of facelets: http://www.ibm.com/developerworks/java/library/j-facelets/

Resources