0

Hi
I want to pass the data from one JSF page to another without using query string.
Any idea how this can be done??

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by babbu
0

I have tried all that..all resulting into null pointer exceptions, probably I have gone wrong somewhere. Please advise.

0

Well then post your session coding attempt and I'm sure someone will look at it. Without code we are just hypothetically talking about issue... not really productive

0

I have tried the following.
I managed to get the value from the parent window to the popup. But I am unable to fetch that value in processAction method of the FacesPortlet.
request.getAttribute("attributeName"); returns null.

public class ModelManagedBean {

	public static final String
		SHARED_STRING_KEY = “sharedStringKey”;

	public String getSharedString() {
		return PortletSessionUtil.getSharedSessionAttribute(
			SHARED_STRING_KEY);
	}

	public void setSharedString(String value) {
		PortletSessionUtil.setSharedSessionAttribute(
			SHARED_STRING_KEY, value);
	}
}

public class PortletSessionUtil {

	public static Object getSharedSessionAttribute(
		String key) {

		FacesContext facesContext =
			FacesContext.getCurrentInstance();

		ExternalContext externalContext =
			facesContext.getExternalContext();

		PortletSession portletSession =
			(PortletSession) externalContext().getSession(false);

		return portletSession.getAttribute(
			key, PortletSession.APPLICATION_SCOPE);
	}

	public static void setSharedSessionAttribute(
		String key, Object value) {

		FacesContext facesContext =
			FacesContext.getCurrentInstance();

		ExternalContext externalContext =
			facesContext.getExternalContext();

		PortletSession portletSession =
			(PortletSession)externalContext().getSession(false);

		portletSession.setAttribute(
			key, value, PortletSession.APPLICATION_SCOPE);
	}
}

getAttribute method here returns null as well

Edited by peter_budo: Keep It Clear - Do use code tags when posting any code

0

For anyone who might be interested. This is what I have done.
The second page is a popup so in page2 i use the following code.

window.opener.document.getelementbyID["element name"];
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.