two small gadgets for you:
1. Get and default bean attributes for different websites or different languages
Sometimes you have the same portlet-code for different websites. I use multiple properties files and select the same within the bean with the following code:
private void initBeanData() {
FacesContext fCtx = FacesContext.getCurrentInstance();
ResourceBundle bundle =
ResourceBundle.getBundle( this.getBundleByHost() , fCtx.getViewRoot().getLocale());
_name = bundle.getString("name_default");
_entryText = bundle.getString("text_default");
}
FacesContext fCtx = FacesContext.getCurrentInstance();
String host = ((PortletRequest)fCtx.getExternalContext().getRequest()).getServerName();
if (host.contains("localhost"))
return "LocalBundle";
...
2. Refresh (backing) Bean
After submitting some input I asked myself how to refresh the backing bean? After some research I found a LOT of people having the same problem.
That seems pretty funny in the meanwhile to me as I realized now how easy that is. Maybe there are some people like me that didn't get it the first time. ;)
Here is the code:
public void reset(ActionEvent actionEvent) {
this.initBeanData();
}
(For the init method: see above :) )
Then of course you have to call the method as always from the view (here: JSP):
I want to refresh only the data table in JSF page when i tried to add a row to the table. Rt now the total page is being refreshed.Please provide me any solution for this.
ReplyDeleteThis is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
ReplyDeletebest rpa training in bangalore
rpa training in bangalore
rpa course in bangalore
RPA training in bangalore
rpa training in chennai
rpa online training
ReplyDeleteWhoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
AWS Training in Bangalore | Best AWS Amazon Web Services…
Amazon Web Services Training in Pune India
AWS Online Training in India | AWS Training | AWS online training
AWS Training in Bangalore | Aws training in Bangalore with placements
I'm regular follow your blog.
ReplyDeletePython Hyderabad
Python Training in Coimbatore
Python Training in Chennai
Python Training in Training
Python Training in Bangalore
I must appreciate you for providing such a valuable content for us. This is one amazing piece of article. Helped a lot in increasing my knowledge
ReplyDeletejava training in chennai
java training in porur
aws training in chennai
aws training in porur
python training in chennai
python training in porur
selenium training in chennai
selenium training in porur
This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points..
ReplyDeletehadoop training in chennai
hadoop training in omr
salesforce training in chennai
salesforce training in omr
c and c plus plus course in chennai
c and c plus plus course in omr
machine learning training in chennai
machine learning training in omr
ReplyDeleteAdmire this blog. Keep sharing more updates like this
Top Reasons to Secure Tally Data
Reasons to secure Tally Data
This post is so interactive and informative.keep update more information...
ReplyDeleteGerman Classes in Tambaram
German Classes in chennai
kralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
1YZ00Y