How to implement language toggle in jsf? [duplicate] - jsf

This question already has answers here:
Localization in JSF, how to remember selected locale per session instead of per request/view
(5 answers)
Closed 6 years ago.
I have set up internationalizing in my web page,however, language button toggles by it self after clicking different menu on the menubar. I want to display one language in whole web page unless user changes to a different language.I looked for post related to this but couldn't get one.
Any link, idea or book recommendation would be highly appreciated.
Thanks

tag is needed before the beginning of the and tag before closing tag in JSF and PrimeFaces.This is needed only in Facelets Template file and not needed in Facelets Template Client file.

Related

Finding a JSF managed bean implementation class while analyzing Facelets code [duplicate]

This question already has an answer here:
EL proposals / autocomplete / code assist in Facelets with Eclipse
(1 answer)
Closed 5 years ago.
You are analyzing the Facelets code of a very large JSF web application written by others (e.g. during a production incident) and you want to find the bean class that is implementing a bean, knowing its name as it comes in EL expression.
You didn't write it and the bean's name does not match any Java class in the project.
You can't assume that the class is annotated.
While there are several methods to reach to the same result, I hope this question can document the best practices to solve this problem.
NOTE: This question is not about how to enable an IDE option to do so, it is about how to deal with it, without IDE support. I have made many searches and haven't found this question in StackOverflow, in the terms expressed here.
Print it!
(-) Requires to redeploy.
Edit the XHTML file to write out the class' name
<!-- #{msg.getClass().getSimpleName()} -->
Redeploy the modified XHTML file
Reload the page
Look for Annotations
(-) Not always works
Search for the annotation ("#ManagedBean") across the workspace and find the annotation.
Look in Face-Config
Search in faces-config.xml (e.g. ResourceBundles)
IDE Support
E.g. Eclipse with JBoss Tools
EL proposals / autocomplete / code assist in Facelets with Eclipse

Primefaces Filled Field Automatically [duplicate]

This question already has answers here:
Clear JSF form input values after submitting
(5 answers)
Closed 5 years ago.
I'm developing a project using JSF and Primefaces and I got some forms.
Every time I open those forms all fields are already filled with the last information I saved on database.
I'd like every time I open those forms all fields were blank.
How can I do this?
Thank you!!
What Scope are you using in your managed bean? if you are using session scope for example it will hold the last values of your bean properties as long as the application session exists. Depending on what you doing, I would use request scope instead. This will delete the bean when it is not being use and therefore clear the values when you request again. Or perhaps view scope, this will keep the values as long as you are in the same view. Another way would be to use javascript to clear the values by Ids.
if u are using
#SessionScoped
Try to change to :
#ViewScoped

Checking elements changes on page from browser extension [duplicate]

This question already has answers here:
Is there a JavaScript / jQuery DOM change listener?
(5 answers)
Closed 6 years ago.
I find the best variant of checking elements changes on page from content-script of browser extension.
For example I need add button to popup. I must check when popup will loaded and start the include.
The only method that I found is use setInterval.
I think the MutationObserver API is what are you looking for.

Forcing a save as dialogue from any web browser from JSF application [duplicate]

This question already has answers here:
Forcing a save as dialogue from any web browser from JSF application [duplicate]
(3 answers)
Closed 9 years ago.
I have a modal that will be shown and then I have an export button which should bring up the save dialog, if I have use h:commandButton, the validation checks are bypassed , but works well. If I use a4j:commandButton, validations are done perfectly but I dont see the save file dialog.
Can somebody help me.
thanks
I don't do RichFaces, so I can't tell from top of head, but Google learns me that a4j:htmlCommandLink may help. If it does and you'd rather like to have a button, then just throw some CSS in to make the link look like a button.

JSF Back Button [duplicate]

This question already has answers here:
back commandbutton in jsf
(5 answers)
Closed 8 years ago.
How do I make a link which navigates the user back one page (i.e. same as clicking browser back)?
Thanks.
To the point: just remember the request URL or the JSF viewId of the previous page so that you can use it in the href or value of the output/commandlink. There are several ways to achieve it, depending on how you're actually navigating through the pages and how "jsfish" you want to achieve it. You could pass it as a request parameter by f:param in h:outputLink, or you could set it as a bean property by f:setPropertyActionListener in h:commandLink, or you could create a PhaseListener which remembers the viewId and make use of navigation cases, or you could grab the -much less reliable- JavaScript history.go() function.

Resources