Tag Archives: JSF
Popular Web Frameworks
Posted on 07. Sep, 2007 by Tahir Akram.
A post was made on Javalobby in the response of Rick Hightower observation on fastest growing frameworks. According to graph it is clear that there are more jobs of JSF and its demand is increasing as compared to other web frameworks.
Luckily I got chance to work on JSF in my previous job, and I really [...]
Continue Reading
Accessing a selected row from h:dataTable
Posted on 08. Apr, 2007 by Tahir Akram.
Javascript to Select One Radio Button
function selectOne(form, button) {
turnOffRadioForForm(form);
button.checked = true;
}
function turnOffRadioForForm(form) {
for (var i = 0; i < form.elements.length; i++) {
form.elements[i].checked = false;
}
}
JSF Code of h:dataTable Table on JSP Page
We will use valueChangeListener for this, as when user check the radio button we will get the binded value of bean. It is one column. [...]
Continue Reading
Getting and setting Managed Bean objects in JSF
Posted on 08. Apr, 2007 by Tahir Akram.
Get appplication from FacesContext
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
Setting in Managed Bean Object
app.createValueBinding(“#appSessionBean.userDataBean}”).setValue(ctx, userDataBean);
Getting Managed Bean Object(s)
AppSessionBean appSessionBean = (AppSessionBean)app.createValueBinding(“#{appSessionBean}”).getValue(ctx);
userDataBean = (UserDataBean)appSessionBean.getUserDataBean();
where userDataBean is object in ApplicationSessionBean class and this said class is in faces-config with session scope.
Continue Reading
Getting HTTP Session in JSF
Posted on 08. Apr, 2007 by Tahir Akram.
import javax.faces.context.FacesContext;
public void addInSession() {
MySession mySession = new MySession();
mySession.setName(getMsg());
/* .getSession(boolean), true if we want to create new session, if want touse oldsession then false*/
FacesContext context = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
session.setAttribute("sessionObj", mySession);
if (session.getAttribute("sessionObj") != null) {
MySession mySavedSession = (MySession) session.getAttribute("sessionObj");
System.out.println("HTTP Session: " + mySavedSession.getName());
} else {
// do something
}
}
Continue Reading
Getting request parameters in JSF
Posted on 08. Apr, 2007 by Tahir Akram.
Here is the way, how we get request parameters from a JSP page (which is JSF enabled) in a HTTP request object.
import javax.faces.context.FacesContext;
//…your code
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
String controlName = request.getParameter("formId:controlId");
Where formName is refer to the id of your form and controlId is referred to the id of your control.
Continue Reading
Faces Console: A utility for JSF configurations
Posted on 08. Apr, 2007 by Tahir Akram.
Faces Console is a free utility get integrated in many IDEs as plugin and provide JSF (faces-config.xml) configuration facility in a GUI. if you are using NetBeans5.0 or Eclipse3.x you must try it.
http://www.jamesholmes.com/JavaServerFaces/console/


