I'm developing a web application and using JSF 2.2 and Primefaces.
It contains a lot of output texts, user warning messages etc. I want to support many different languages. What is the most usable way to do this? Is there any standard or efficient procedure to achieve this?
JSF supports internationalized messaging through locale specific .properties resource files. Once a locale is set, either implicitly via the browser or explicitly by the user, the appropriate bundle will be loaded. For browser settings:
<f:view locale="#{facesContext.externalContext.requestLocale}">
You will also need to define the <resource-bundle> in you faces-config.xml where base-name defines the base file name and var defines the scoped result map.
I would start with this doc from #BalusC: http://jdevelopment.nl/internationalization-jsf-utf8-encoded-properties-files/
Also from #Mkyong: http://www.mkyong.com/jsf2/jsf-2-message-and-messages-example/
Related
I'm currently trying to use PrimeFaces (not mobile) for my WebSphere 8.0 application. The basic stuff like p:dataTable seems to work. But if I want to use the fancy stuff of PrimeFaces, like filter columns or pagination, there is either a NullPointerException or the additional function is not rendered at all.
The Nullpointer occurred when entering something in the generated filtering field in the table. The setter method that is called is given null as parameter.
The pagination on the other hand is not even being rendered. (I used the templates of the PrimeFace showcase)
Weird thing is, the sorting by column function is working fine.
I haven't done any big adjustments, just put the .jar file to my classpath and disabled all themes of PrimeFaces in my web.xml. That's it.
When I inspect the network and stuff in chrome there is no exception thrown in the console when loading the page.
Now I'm thinking that this version of PrimeFaces is not compatible with MyFaces2.0 that is used by WAS8.0.
Is that the case? If so, what version of PF would be compatible? Or would it be possible to load a newer Version of MyFaces and dependencies and put it in WAS to use this version instead of the current used version?
Or maybe I have to make some adjustments to my application?
If everything is not possible, do you know an alternative to PF to easily create tables?
Using a third-party JSF provider with WebSphere is documented here (the doc is for 8.5.5, but it's the same procedure in 8.0): https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tweb_jsf.html
Basically, the answer is to put your provider (along with the corresponding API) into a shared library, set that library to use an isolated class loader, and associate that shared library with your web app. That will tell the web module's class loader to search your shared library before it delegates to server class loaders, and it'll find your JSF provider first when your app attempts to use JSF.
Both files seem very similar, subsequently I'm struggling to understand their purposes.
I have seen faces-config referred to as a plain JSF controller, while adfc-config is an extended ADF controller.
Some clarification would be good, as right now I can't see why you would have both in an ADF application if that is the case, so I must be missing something.
adfc-config is different from faces-config
Faces Config is the controller of your application, it's what make JSF based frameworks work effectively, and it's where you will need to define your own customization like view handlers, converters, validators, etc...
adfc-config is just the main application unbounded Task Flow, which make it a little easier for developers to define their pages and main navigation root inside of it instead of doing it the JSF way and define them in faces config, it also provide additional functionality like defining managed beans which will have much more scopes than the original JSF given the ADF Framework additions, but still at the end it's just an Unbounded Task Flow. Here is the documentation reference about adfc-config.xml
adfc-config is used by the ADF Faces framework, when task flows are in the picture.
More information at: http://docs.oracle.com/cd/E23943_01/web.1111/b31974/taskflows.htm
Yes, you are right when you say that the functionality looks similar. Things like pageFlowScope / backingBeanScope / task flows / etc. are extensions to the standard JSF framework and require a custom configuration file.
So, if you create a project based on the Fusion WebApplication template, then you will see a default adfc-config.xml file entry.
Hope that helps.
Is it preferable to use JSF's h:outputScript or h:outputStylesheet when script/style elements may just work for you ? What advantages does former offer over the latter ?
The JSF builtin resource handling has at least the following advantages:
Resource versioning
Configurable cache control
Packaging in JAR
Programmatic (component based) manipulation
Automatic prepending of right context path
EL support in CSS files
i18n support (different resource files based on user's locale)
Automatic HTTP/2 push (JSF 2.3+ on HTTPS only)
See also:
How to reference CSS / JS / image resource in Facelets template?
What is the JSF resource library for and how should it be used?
Normal script/styles work if you know exactly under which context url the application is deployed.
So if you want to deploy the application under another context url you have to change your jsf code if you use script/style instead of h:outputScript and h:outputStylesheet.
I was wondering if it's possible to add JSF components to the tag library programmatically?
I'm implementing a plug-in mechanism in our application. And now, if I create a JSF component in the plug-in, I need to change the components taglib xml file in the main application, which is not the goal.
I'd rather like to put a components taglib xml file inside a plug-in which is then handled by the main application. Is there any way to do that?
The reason why I'm asking this is the following:
In our application, we send secure messages through a web interface. The messages are created by filling out forms, which are, in most cases, generated. But some forms have special behavior and we don't want to release the whole application if a new 'special form' is implemented, so we decided to put these in plug-ins.
Thanks for any help.
Cheers,
Andreas
I would like to know what does .do webpages stand for ( as .php stands for PHP pages with PHP Scripting) and what is the scripting language behind it.
http://www.fileinfo.com/extension/do
According to WikiPedia, .do is:
a pseudo file extension representing
an Apache Struts action. It does not
map to an actual file extension,
although it appears that way.
However, you can't really say anything about the technology behind based solely on the "extension", i.e., the server can be configured to use .do for PHP files etc. This can be done in order to secure backwards compatibility or whatever.
.do is the commonly used convention to denote a Struts action. Like .jsf for JSF .
But there is no compulsion that all struts action should map to .do extenstion. It can be configured in
web.xml to .anything. Also a simple servlet can also be mapped to a .do extension. So nothing can be derived by just looking
at the URL.
While .do seems to be a Struts convention, it is used in Spring and Spring MVC as well. This SO thread talks a little bit about that, also noting that whereever Servlets are used, '.do' files can be used: Why do Java webapps use .do extension? Where did it come from?