JSF and JSP communication
From JSF call JSP bean:
JSP file:
<jsp:useBean id="testbean" scope="session" class="jsftest.TestBean"/>
<jsp:setProperty name="testbean" property="email" value="abc@msn.com"/>
JSP managed bean:
javax.servlet.http.HttpSession se = (javax.servlet.http.HttpSession)javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getSession(true);
TestBean testbean = (TestBean)se.getAttribute("testbean");
email = testbean.getEmail();
From JSP call JSF bean: using sessionScope
${sessionScope.PersonBean.email}
JSP file:
<jsp:useBean id="testbean" scope="session" class="jsftest.TestBean"/>
<jsp:setProperty name="testbean" property="email" value="abc@msn.com"/>
JSP managed bean:
javax.servlet.http.HttpSession se = (javax.servlet.http.HttpSession)javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getSession(true);
TestBean testbean = (TestBean)se.getAttribute("testbean");
email = testbean.getEmail();
From JSP call JSF bean: using sessionScope
${sessionScope.PersonBean.email}

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home