JSF: Lesson – 4: Accessing Context Data from Beans #Java Short Notes

  • In some cases, from the beans used in JSF applications, you will need to access the request parameters. For example, in the BusSearch.java, we accessed, the request parameters [Please check the previous JSF lesson].
  • How to access: FacesContext context = FacesContext.getCurrentInstance();
  • Some methods of FacesContext:
    • Map getApplicationMap()
    • String getInitParameter(java.lang.String name)
    • Map getInitParameterMap()
    • String getRemoteUser()
    • Map getRequestCookieMap()
    • Map getRequestHeaderMap()
    • Map getRequestHeaderValuesMap()
    • Map getRequestMap()
    • Map getRequestParameterMap()
    • Iterator getRequestParameterNames()
    • Map getRequestParameterValuesMap()
    • Map getSessionMap()
  • Sample code:
    FacesContext context = FacesContext.getCurrentInstance();
  • Map requestParams =    context.getExternalContext().getRequestParameterMap();
  • String tripNum = (String) requestParams.get("tripNum");

From: http://sitestree.com/?p=4995
Categories:Java Short Notes
Tags:
Post Data:2007-08-18 13:22:28

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada